Skip to content

Commit

Permalink
Allow env var to change use-path-style param of s3 config
Browse files Browse the repository at this point in the history
  • Loading branch information
bestmazzo committed May 13, 2024
1 parent 279714c commit 2c94a59
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
s3SecretKeyFlag = "s3-secret-key" //nolint: gosec
s3RegionFlag = "s3-region"
s3BucketFlag = "s3-bucket"
s3UsePathStyle = "s3-use-path-style"
s3RootFolderFlag = "s3-root-folder"
s3DisableHTTPS = "s3-disable-http"
postgresMigrationsFlag = "postgres-migrations"
Expand Down Expand Up @@ -144,7 +145,7 @@ func getMetadataStorage(endpoint string) *metadata.Hasura {
func getContentStorage(
ctx context.Context,
s3Endpoint, region, s3AccessKey, s3SecretKey, bucket, rootFolder string,
disableHTTPS bool,
disableHTTPS, usePathStyle bool,
logger *logrus.Logger,
) *storage.S3 {
var cfg aws.Config
Expand All @@ -169,7 +170,7 @@ func getContentStorage(
cfg,
func(o *s3.Options) {
o.BaseEndpoint = aws.String(s3Endpoint)
o.UsePathStyle = true
o.UsePathStyle = usePathStyle
o.EndpointOptions.DisableHTTPS = disableHTTPS
},
)
Expand Down Expand Up @@ -339,6 +340,7 @@ var serveCmd = &cobra.Command{
viper.GetString(s3BucketFlag),
viper.GetString(s3RootFolderFlag),
viper.GetBool(s3DisableHTTPS),
viper.GetBool(s3UsePathStyle),
logger,
)

Expand Down

0 comments on commit 2c94a59

Please sign in to comment.