@@ -29,20 +29,23 @@ type Client struct {
29
29
Users * UserService
30
30
}
31
31
32
- // DefaultClientOptions read from the environment (GITPOD_API_KEY). This should be
33
- // used to initialize new clients.
32
+ // DefaultClientOptions read from the environment (GITPOD_API_KEY,
33
+ // GITPOD_BASE_URL). This should be used to initialize new clients.
34
34
func DefaultClientOptions () []option.RequestOption {
35
35
defaults := []option.RequestOption {option .WithEnvironmentProduction ()}
36
+ if o , ok := os .LookupEnv ("GITPOD_BASE_URL" ); ok {
37
+ defaults = append (defaults , option .WithBaseURL (o ))
38
+ }
36
39
if o , ok := os .LookupEnv ("GITPOD_API_KEY" ); ok {
37
40
defaults = append (defaults , option .WithBearerToken (o ))
38
41
}
39
42
return defaults
40
43
}
41
44
42
45
// NewClient generates a new client with the default option read from the
43
- // environment (GITPOD_API_KEY). The option passed in as arguments are applied
44
- // after these default arguments, and all option will be passed down to the
45
- // services and requests that this client makes.
46
+ // environment (GITPOD_API_KEY, GITPOD_BASE_URL ). The option passed in as arguments
47
+ // are applied after these default arguments, and all option will be passed down to
48
+ // the services and requests that this client makes.
46
49
func NewClient (opts ... option.RequestOption ) (r * Client ) {
47
50
opts = append (DefaultClientOptions (), opts ... )
48
51
0 commit comments