Update main.go
This commit is contained in:
parent
db8b5e2a86
commit
12e23524dd
1 changed files with 11 additions and 1 deletions
10
main.go
10
main.go
|
@ -35,6 +35,7 @@ type configuration struct {
|
|||
ForceDownload bool
|
||||
UseSSL bool
|
||||
SkipSSLVerification bool
|
||||
SkipSignature bool
|
||||
ListRecursive bool
|
||||
Port string
|
||||
Timeout int32
|
||||
|
@ -80,6 +81,9 @@ func parseConfiguration() configuration {
|
|||
viper.SetDefault("SKIP_SSL_VERIFICATION", false)
|
||||
skipSSLVerification := viper.GetBool("SKIP_SSL_VERIFICATION")
|
||||
|
||||
viper.SetDefault("SKIP_SIGNATURE", false)
|
||||
skipSignature := viper.GetBool("SKIP_SIGNATURE")
|
||||
|
||||
listRecursive := viper.GetBool("LIST_RECURSIVE")
|
||||
|
||||
viper.SetDefault("PORT", "8080")
|
||||
|
@ -90,6 +94,7 @@ func parseConfiguration() configuration {
|
|||
|
||||
viper.SetDefault("SSE_TYPE", "")
|
||||
sseType := viper.GetString("SSE_TYPE")
|
||||
|
||||
viper.SetDefault("SSE_KEY", "")
|
||||
sseKey := viper.GetString("SSE_KEY")
|
||||
|
||||
|
@ -104,6 +109,7 @@ func parseConfiguration() configuration {
|
|||
ForceDownload: forceDownload,
|
||||
UseSSL: useSSL,
|
||||
SkipSSLVerification: skipSSLVerification,
|
||||
SkipSignature: skipSignature,
|
||||
ListRecursive: listRecursive,
|
||||
Port: port,
|
||||
Timeout: timeout,
|
||||
|
@ -135,9 +141,13 @@ func main() {
|
|||
}
|
||||
if configuration.UseIam {
|
||||
opts.Creds = credentials.NewIAM(configuration.IamEndpoint)
|
||||
} else {
|
||||
if (configuration.SkipSignature) {
|
||||
opts.Creds = credentials.NewStatic(configuration.AccessKeyID, configuration.SecretAccessKey, "", SignatureType.SignatureAnonymous)
|
||||
} else {
|
||||
opts.Creds = credentials.NewStaticV4(configuration.AccessKeyID, configuration.SecretAccessKey, "")
|
||||
}
|
||||
}
|
||||
|
||||
if configuration.Region != "" {
|
||||
opts.Region = configuration.Region
|
||||
|
|
Loading…
Reference in a new issue