Skip to content

Commit 2c0c222

Browse files
committed
chore(controller-sdk-go): use drycc service key
1 parent 5e021eb commit 2c0c222

6 files changed

Lines changed: 16 additions & 18 deletions

File tree

apps/apps.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ func Logs(c *drycc.Client, appID string, request api.AppLogsRequest) (*websocket
102102
return nil, err
103103
}
104104
config.Header = http.Header{
105-
"User-Agent": {c.UserAgent},
106-
"Authorization": {"token " + c.Token},
107-
"X-Drycc-Builder-Auth": {c.HooksToken},
105+
"User-Agent": {c.UserAgent},
106+
"Authorization": {"token " + c.Token},
107+
"X-Drycc-Service-Key": {c.ServiceKey},
108108
}
109109
conn, err := websocket.DialConfig(config)
110110
if err != nil {

drycc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ type Client struct {
8282
// Token is used to authenticate the request against the API.
8383
Token string
8484

85-
// HooksToken is the controller token used with the hooks resource.
85+
// ServiceKey is the controller token used with the hooks resource.
8686
// The hooks resource isn't intended to be used by users, so it requires
8787
// a service token rather than a user token.
88-
HooksToken string
88+
ServiceKey string
8989
}
9090

9191
// APIVersion is the api version compatible with the SDK.

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
44
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
55
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
66
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
7-
golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA=
8-
golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I=
97
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
108
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
119
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=

http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ func (c *Client) Do(req *http.Request) (*http.Response, error) {
3030
req.Header.Add("Authorization", "token "+c.Token)
3131
}
3232

33-
if c.HooksToken != "" {
34-
req.Header.Add("X-Drycc-Builder-Auth", c.HooksToken)
33+
if c.ServiceKey != "" {
34+
req.Header.Add("X-Drycc-Service-Key", c.ServiceKey)
3535
}
3636
if req.Header.Get("Content-Type") == "" {
3737
req.Header.Add("Content-Type", "application/json")

http_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ func (f fakeHTTPServer) ServeHTTP(res http.ResponseWriter, req *http.Request) {
6969
}
7070

7171
bT := "testing"
72-
if req.Header.Get("X-Drycc-Builder-Auth") != bT {
73-
fmt.Printf("Hook Token Wrong: Expected %s, Got %s\n", bT, req.Header.Get("X-Drycc-Builder-Auth"))
72+
if req.Header.Get("X-Drycc-Service-Key") != bT {
73+
fmt.Printf("Hook Token Wrong: Expected %s, Got %s\n", bT, req.Header.Get("X-Drycc-Service-Key"))
7474
res.WriteHeader(http.StatusInternalServerError)
7575
res.Write(nil)
7676
return
@@ -161,7 +161,7 @@ func TestBasicRequest(t *testing.T) {
161161
t.Fatal(err)
162162
}
163163
drycc.UserAgent = "test"
164-
drycc.HooksToken = "testing"
164+
drycc.ServiceKey = "testing"
165165

166166
res, err := drycc.Request("POST", "/request/", []byte("test"))
167167
if err != nil {

ps/ps.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ func Exec(c *drycc.Client, appID, podID string, command api.Command) (*websocket
4242
return nil, err
4343
}
4444
config.Header = http.Header{
45-
"User-Agent": {c.UserAgent},
46-
"Authorization": {"token " + c.Token},
47-
"X-Drycc-Builder-Auth": {c.HooksToken},
45+
"User-Agent": {c.UserAgent},
46+
"Authorization": {"token " + c.Token},
47+
"X-Drycc-Service-Key": {c.ServiceKey},
4848
}
4949
conn, err := websocket.DialConfig(config)
5050
if err != nil {
@@ -68,9 +68,9 @@ func Logs(c *drycc.Client, appID, podID string, request api.PodLogsRequest) (*we
6868
return nil, err
6969
}
7070
config.Header = http.Header{
71-
"User-Agent": {c.UserAgent},
72-
"Authorization": {"token " + c.Token},
73-
"X-Drycc-Builder-Auth": {c.HooksToken},
71+
"User-Agent": {c.UserAgent},
72+
"Authorization": {"token " + c.Token},
73+
"X-Drycc-Service-Key": {c.ServiceKey},
7474
}
7575
conn, err := websocket.DialConfig(config)
7676
if err != nil {

0 commit comments

Comments
 (0)