From f5a12d1c615ba68bbfd616f986fa50a61e7ceb7b Mon Sep 17 00:00:00 2001 From: Charlie Moog Date: Mon, 1 Mar 2021 11:08:27 -0600 Subject: [PATCH] chore: allow custom auth header via ENDPOINT_AUTH_HEADER --- coder-sdk/request.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coder-sdk/request.go b/coder-sdk/request.go index b24ffefa..a49ddda1 100644 --- a/coder-sdk/request.go +++ b/coder-sdk/request.go @@ -8,6 +8,7 @@ import ( "io" "net/http" "net/url" + "os" "strings" "golang.org/x/xerrors" @@ -92,6 +93,11 @@ func (c *DefaultClient) request(ctx context.Context, method, path string, in int // Provide the session token in a header req.Header.Set("Session-Token", c.token) + customAuthHeader, ok := os.LookupEnv("ENDPOINT_AUTH_HEADER") + if ok { + req.Header.Set("Authorization", customAuthHeader) + } + // Execute the request. return c.httpClient.Do(req) }