We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is there any way to create a FS that accesses only a subdir in S3? (basically a prefix/ to everything)
prefix/
The text was updated successfully, but these errors were encountered:
Small edit for clarification: I have seen afero.NewBasePathFs but I am not sure if it is a good direction
afero.NewBasePathFs
Sorry, something went wrong.
diff --git a/fs/s3/s3.go b/fs/s3/s3.go index b4756f8..ae2e413 100644 --- a/fs/s3/s3.go +++ b/fs/s3/s3.go @@ -18,6 +18,7 @@ func LoadFs(access *confpar.Access) (afero.Fs, error) { bucket := access.Params["bucket"] keyID := access.Params["access_key_id"] secretAccessKey := access.Params["secret_access_key"] + basePath := access.Params["base_path"] conf := aws.Config{ Region: aws.String(region), @@ -42,6 +43,9 @@ func LoadFs(access *confpar.Access) (afero.Fs, error) { s3Fs := s3.NewFs(bucket, sess) // s3Fs = stripprefix.NewStripPrefixFs(s3Fs, 1) - - return s3Fs, nil + if basePath != "" { + return afero.NewBasePathFs(s3Fs, basePath), nil + } else { + return s3Fs, nil + } }
No branches or pull requests
Is there any way to create a FS that accesses only a subdir in S3? (basically a
prefix/
to everything)The text was updated successfully, but these errors were encountered: