2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 14:56:29 +00:00

Add AWS_REGION env var to specify s3 region

This commit is contained in:
mdauphin 2019-07-23 11:14:26 +02:00 committed by Alexander Neumann
parent aa5af8af0e
commit df500a372d
3 changed files with 6 additions and 1 deletions

View File

@ -485,6 +485,10 @@ func parseConfig(loc location.Location, opts options.Options) (interface{}, erro
cfg.Secret = os.Getenv("AWS_SECRET_ACCESS_KEY")
}
if cfg.Region == "" {
cfg.Region = os.Getenv("AWS_REGION")
}
if err := opts.Apply(loc.Scheme, &cfg); err != nil {
return nil, err
}

View File

@ -22,6 +22,7 @@ type Config struct {
Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
MaxRetries uint `option:"retries" help:"set the number of retries attempted"`
Region string
}
// NewConfig returns a new Config with the default values filled in.

View File

@ -66,7 +66,7 @@ func open(cfg Config, rt http.RoundTripper) (*Backend, error) {
},
},
})
client, err := minio.NewWithCredentials(cfg.Endpoint, creds, !cfg.UseHTTP, "")
client, err := minio.NewWithCredentials(cfg.Endpoint, creds, !cfg.UseHTTP, cfg.Region)
if err != nil {
return nil, errors.Wrap(err, "minio.NewWithCredentials")
}