Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow env var to change use-path-style param of s3 config #209

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 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"
s3UseSubdomainStyle = "s3-use-subdomain-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, useSubdomainStyle 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 = !useSubdomainStyle
o.EndpointOptions.DisableHTTPS = disableHTTPS
},
)
Expand Down Expand Up @@ -249,6 +250,7 @@ func init() { //nolint:funlen
"",
"All buckets will be created inside this root",
)
addBoolFlag(serveCmd.Flags(), s3UseSubdomainStyle, false, "Use Subdomain style for S3 endpoint")
}

{
Expand Down Expand Up @@ -339,6 +341,7 @@ var serveCmd = &cobra.Command{
viper.GetString(s3BucketFlag),
viper.GetString(s3RootFolderFlag),
viper.GetBool(s3DisableHTTPS),
viper.GetBool(s3UseSubdomainStyle),
logger,
)

Expand Down