@@ -23,40 +23,40 @@ import (
2323)
2424
2525type apiClientOpt struct {
26- uri string
27- insecure bool
28- username string
29- password string
30- headers map [string ]string
31- timeout int
32- idAttribute string
33- createMethod string
34- readMethod string
35- readData string
36- updateMethod string
37- updateData string
38- destroyMethod string
39- destroyData string
40- copyKeys []string
41- writeReturnsObject bool
42- createReturnsObject bool
43- xssiPrefix string
44- useCookies bool
45- rateLimit float64
46- oauthClientIDEnvVar string
26+ uri string
27+ insecure bool
28+ username string
29+ password string
30+ headers map [string ]string
31+ timeout int
32+ idAttribute string
33+ createMethod string
34+ readMethod string
35+ readData string
36+ updateMethod string
37+ updateData string
38+ destroyMethod string
39+ destroyData string
40+ copyKeys []string
41+ writeReturnsObject bool
42+ createReturnsObject bool
43+ xssiPrefix string
44+ useCookies bool
45+ rateLimit float64
46+ oauthClientIDEnvVar string
4747 oauthClientSecretEnvVar string
48- oauthClientID string
49- oauthClientSecret string
50- oauthScopes []string
51- oauthTokenURL string
52- oauthEndpointParams url.Values
53- certFile string
54- keyFile string
55- rootCAFile string
56- certString string
57- keyString string
58- rootCAString string
59- debug bool
48+ oauthClientID string
49+ oauthClientSecret string
50+ oauthScopes []string
51+ oauthTokenURL string
52+ oauthEndpointParams url.Values
53+ certFile string
54+ keyFile string
55+ rootCAFile string
56+ certString string
57+ keyString string
58+ rootCAString string
59+ debug bool
6060}
6161
6262/*APIClient is a HTTP client with additional controlling fields*/
@@ -84,12 +84,13 @@ type APIClient struct {
8484 oauthConfig * clientcredentials.Config
8585}
8686
87+ // Helper function for optional environment imports
8788func GetEnvStringOrDefault (key , def string ) string {
88- if env := os .Getenv (key ); env != "" {
89- log .Printf ("Got env for %s" , key )
90- return env
91- }
92- return def
89+ if env := os .Getenv (key ); env != "" {
90+ log .Printf ("Got env for %s" , key )
91+ return env
92+ }
93+ return def
9394}
9495
9596// NewAPIClient makes a new api client for RESTful calls
@@ -215,7 +216,7 @@ func NewAPIClient(opt *apiClientOpt) (*APIClient, error) {
215216 debug : opt .debug ,
216217 }
217218
218- resolvedClientID := GetEnvStringOrDefault (opt .oauthClientIDEnvVar , opt .oauthClientID )
219+ resolvedClientID := GetEnvStringOrDefault (opt .oauthClientIDEnvVar , opt .oauthClientID )
219220 resolvedClientSecret := GetEnvStringOrDefault (opt .oauthClientSecretEnvVar , opt .oauthClientSecret )
220221
221222 if resolvedClientID != "" && resolvedClientSecret != "" && opt .oauthTokenURL != "" {
0 commit comments