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