Skip to content

Commit

Permalink
add s3ForcePathStyle parameter
Browse files Browse the repository at this point in the history
to e.g. use S3 with minio when buckets are not configured as subdomains
  • Loading branch information
flixr committed Apr 24, 2020
1 parent 740d1c2 commit 8047c62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ Default value: `shared`
| `api` | A string in `YYYY-MM-DD` format that represents the latest possible API version that can be used in this service. Specify `latest` to use the latest possible version. | `api=latest` |
| `acl` | The [ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) for new or updated files to use. Default: `private` | `acl=public-read` |
| `debug` | Set to `1`, to debug a connection, by writing all messages to [log files](#logs-). Default: `0` | `debug=1` |
| `endpoint` | The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like `https://{service}.{region}.amazonaws.com`. | `endpoint=https%3A%2F%2Ffoo.bar.amazonaws.com` |
| `endpoint` | The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like `https://{service}.{region}.amazonaws.com`. | `endpoint=https%3A%2F%2Ffoo.bar.amazonaws.com` |
| `s3ForcePathStyle` | Set to `1`, to force path style URLs for S3 objects. Default: `0` | `s3ForcePathStyle=1` |
| `file` | If credential type is set to `file`, this defines the path to the `.json` file, which should be used. Relative paths will be mapped to the `.aws` sub folder inside the user's home directory. | `file=aws.json` |
| `params` | The name of an external file, which contains other parameters for the URI. s. [Import parameters](#import-parameters-) | `params=s3_uri_params.json` |
| `profile` | If credential type is set to `shared`, this defines the name of the section inside the `.ini` file, which should be used. Default: `default` | `profile=mkloubert` |
Expand Down
3 changes: 3 additions & 0 deletions src/fs/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ export class S3FileSystem extends vscrw_fs.FileSystemBase {
endpoint = undefined;
}

let s3ForcePathStyle = vscrw.isTrue(PARAMS['s3ForcePathStyle']);

let api = vscode_helpers.toStringSafe( PARAMS['api'] ).trim();
if ('' === api) {
api = undefined;
Expand Down Expand Up @@ -381,6 +383,7 @@ export class S3FileSystem extends vscrw_fs.FileSystemBase {
logger: logger,
credentials: new credentialClass(credentialConfig),
endpoint: endpoint,
s3ForcePathStyle: s3ForcePathStyle,
params: {
Bucket: this.getBucket( uri ),
ACL: this.getDefaultAcl(),
Expand Down

2 comments on commit 8047c62

@ianferreira
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flixr any update, I am trying to use this with S3 provider that user path not subdomains

@flixr
Copy link
Owner Author

@flixr flixr commented on 8047c62 Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't really figure out how to do this... please use mkloubert#136 for discussion and upvote if you have the same need.

Please sign in to comment.