mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
Add flag of S3ForcePathStyle (#1802)
This commit is contained in:
parent
273fbc2e8a
commit
6662714c6c
2 changed files with 12 additions and 7 deletions
|
@ -21,6 +21,7 @@ var (
|
|||
configProfile = flag.String("configProfile", "", "Profile name for S3 configs. If no set, the value of the environment variable will be loaded (AWS_PROFILE or AWS_DEFAULT_PROFILE), "+
|
||||
"or if both not set, DefaultSharedConfigProfile is used")
|
||||
customS3Endpoint = flag.String("customS3Endpoint", "", "Custom S3 endpoint for use with S3-compatible storages (e.g. MinIO). S3 is used if not set")
|
||||
s3ForcePathStyle = flag.Bool("s3ForcePathStyle", true, "Prefixing endpoint with bucket name when set false, true by default.")
|
||||
)
|
||||
|
||||
func runParallel(concurrency int, parts []common.Part, f func(p common.Part) error, progress func(elapsed time.Duration)) error {
|
||||
|
@ -222,6 +223,7 @@ func NewRemoteFS(path string) (common.RemoteFS, error) {
|
|||
CredsFilePath: *credsFilePath,
|
||||
ConfigFilePath: *configFilePath,
|
||||
CustomEndpoint: *customS3Endpoint,
|
||||
S3ForcePathStyle: *s3ForcePathStyle,
|
||||
ProfileName: *configProfile,
|
||||
Bucket: bucket,
|
||||
Dir: dir,
|
||||
|
|
|
@ -37,6 +37,9 @@ type FS struct {
|
|||
// Set for using S3-compatible enpoint such as MinIO etc.
|
||||
CustomEndpoint string
|
||||
|
||||
// Force to use path style for s3, true by default.
|
||||
S3ForcePathStyle bool
|
||||
|
||||
// The name of S3 config profile to use.
|
||||
ProfileName string
|
||||
|
||||
|
@ -83,7 +86,7 @@ func (fs *FS) Init() error {
|
|||
sess.Config.WithEndpoint(fs.CustomEndpoint)
|
||||
|
||||
// Disable prefixing endpoint with bucket name
|
||||
sess.Config.WithS3ForcePathStyle(true)
|
||||
sess.Config.WithS3ForcePathStyle(fs.S3ForcePathStyle)
|
||||
} else {
|
||||
// Determine bucket region.
|
||||
ctx := context.Background()
|
||||
|
|
Loading…
Reference in a new issue