File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,11 @@ func main() {
58
58
os .Exit (10 )
59
59
}
60
60
61
- awsClient := createAWSClient (cfg .Region )
61
+ awsClient , err := createAWSClient (cfg .Region )
62
+ if err != nil {
63
+ log .Printf ("Couldn't create AWS client: %v" , err )
64
+ os .Exit (10 )
65
+ }
62
66
63
67
for _ , ups := range cfg .Upstreams {
64
68
if ups .Kind == "http" {
@@ -142,16 +146,16 @@ func main() {
142
146
}
143
147
}
144
148
145
- func createAWSClient (region string ) * AWSClient {
149
+ func createAWSClient (region string ) ( * AWSClient , error ) {
146
150
httpClient := & http.Client {Timeout : connTimeoutInSecs * time .Second }
147
151
cfg := & aws.Config {Region : aws .String (region ), HTTPClient : httpClient }
148
- session , err := session .NewSession (cfg )
149
152
153
+ session , err := session .NewSession (cfg )
150
154
if err != nil {
151
- log . Printf ( "Error while creating AWS Client: %v" , err )
155
+ return nil , err
152
156
}
153
157
154
158
svcAutoscaling := autoscaling .New (session )
155
159
svcEC2 := ec2 .New (session )
156
- return NewAWSClient (svcEC2 , svcAutoscaling )
160
+ return NewAWSClient (svcEC2 , svcAutoscaling ), nil
157
161
}
You can’t perform that action at this time.
0 commit comments