Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 192b49e

Browse files
authored
chore: allow custom auth header via ENDPOINT_AUTH_HEADER (#254)
1 parent 08f1935 commit 192b49e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

coder-sdk/request.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"io"
99
"net/http"
1010
"net/url"
11+
"os"
1112
"strings"
1213

1314
"golang.org/x/xerrors"
@@ -92,6 +93,11 @@ func (c *DefaultClient) request(ctx context.Context, method, path string, in int
9293
// Provide the session token in a header
9394
req.Header.Set("Session-Token", c.token)
9495

96+
customAuthHeader, ok := os.LookupEnv("ENDPOINT_AUTH_HEADER")
97+
if ok {
98+
req.Header.Set("Authorization", customAuthHeader)
99+
}
100+
95101
// Execute the request.
96102
return c.httpClient.Do(req)
97103
}

0 commit comments

Comments
 (0)