From 2c94a597f7c7d5580f83cb24b4907b23b41ba378 Mon Sep 17 00:00:00 2001 From: Matteo Mazzoni Date: Mon, 13 May 2024 16:08:36 +0200 Subject: [PATCH] Allow env var to change use-path-style param of s3 config --- cmd/serve.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/serve.go b/cmd/serve.go index 3ea7a423..54bfaa3b 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -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" @@ -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 @@ -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 }, ) @@ -339,6 +340,7 @@ var serveCmd = &cobra.Command{ viper.GetString(s3BucketFlag), viper.GetString(s3RootFolderFlag), viper.GetBool(s3DisableHTTPS), + viper.GetBool(s3UsePathStyle), logger, )