INNER CODE UNIT · Go
amazonBackendFromConfig
helm/chartmuseum · cmd/chartmuseum/main.go:174
func amazonBackendFromConfig(conf *config.Config) storage.Backend {
// If using alternative s3 endpoint (e.g. Minio) default region to us-east-1
if conf.GetString("storage.amazon.endpoint") != "" && conf.GetString("storage.amazon.region") == "" {
conf.Set("storage.amazon.region", "us-east-1")
}
crashIfConfigMissingVars(conf, []string{"storage.amazon.bucket", "storage.amazon.region"})
forcePathStyle := conf.GetBool("storage.amazon.forcepathstyle")
return storage.NewAmazonS3BackendWithOptions(
conf.GetString("storage.amazon.bucket"),
conf.GetString("storage.amazon.prefix"),
conf.GetString("storage.amazon.region"),
conf.GetString("storage.amazon.endpoint"),
conf.GetString("storage.amazon.sse"),
&storage.AmazonS3Options{
S3ForcePathStyle: &forcePathStyle,
},
)
}