-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.go
More file actions
38 lines (29 loc) · 714 Bytes
/
client.go
File metadata and controls
38 lines (29 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package waypointsecrets
import (
"errors"
waypoint "github.com/hashicorp-dev-advocates/waypoint-client/pkg/client"
"log"
)
type waypointClient struct {
waypoint.Waypoint
}
func newClient(config *waypointConfig) (*waypointClient, error) {
if config == nil {
return nil, errors.New("client configuration was nil")
}
if config.Token == "" {
return nil, errors.New("token was not defined")
}
if config.Addr == "" {
return nil, errors.New("waypoint server address was not defined")
}
// create a client
conf := waypoint.DefaultConfig()
conf.Token = config.Token
conf.Address = config.Addr
c, err := waypoint.New(conf)
if err != nil {
log.Fatal(err)
}
return &waypointClient{c}, nil
}