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