Add path style configurations for S3.
This commit is contained in:
parent
5acd1551c9
commit
5add7ad645
@ -11,6 +11,7 @@ export interface S3Config {
|
|||||||
s3AccessKeyID: string;
|
s3AccessKeyID: string;
|
||||||
s3SecretAccessKey: string;
|
s3SecretAccessKey: string;
|
||||||
s3BucketName: string;
|
s3BucketName: string;
|
||||||
|
forcePathStyle: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DropboxConfig {
|
export interface DropboxConfig {
|
||||||
|
|||||||
@ -34,6 +34,7 @@ export const DEFAULT_S3_CONFIG = {
|
|||||||
s3AccessKeyID: "",
|
s3AccessKeyID: "",
|
||||||
s3SecretAccessKey: "",
|
s3SecretAccessKey: "",
|
||||||
s3BucketName: "",
|
s3BucketName: "",
|
||||||
|
forcePathStyle: false
|
||||||
};
|
};
|
||||||
|
|
||||||
export type S3ObjectType = _Object;
|
export type S3ObjectType = _Object;
|
||||||
@ -69,6 +70,7 @@ export const getS3Client = (s3Config: S3Config) => {
|
|||||||
const s3Client = new S3Client({
|
const s3Client = new S3Client({
|
||||||
region: s3Config.s3Region,
|
region: s3Config.s3Region,
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
|
forcePathStyle: s3Config.forcePathStyle,
|
||||||
credentials: {
|
credentials: {
|
||||||
accessKeyId: s3Config.s3AccessKeyID,
|
accessKeyId: s3Config.s3AccessKeyID,
|
||||||
secretAccessKey: s3Config.s3SecretAccessKey,
|
secretAccessKey: s3Config.s3SecretAccessKey,
|
||||||
|
|||||||
@ -488,7 +488,7 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
|||||||
new Setting(s3Div)
|
new Setting(s3Div)
|
||||||
.setName("s3Region")
|
.setName("s3Region")
|
||||||
.setDesc(
|
.setDesc(
|
||||||
"s3Region: If you are not sure what to enter, you could try the vaule: us-east-1"
|
"s3Region: If you are not sure what to enter, you could try the value: us-east-1"
|
||||||
)
|
)
|
||||||
.addText((text) =>
|
.addText((text) =>
|
||||||
text
|
text
|
||||||
@ -539,6 +539,20 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
new Setting(s3Div)
|
||||||
|
.setName("s3 URL Style")
|
||||||
|
.setDesc("Whether to use virtual-hosted style URLs (e.g. https://bucket.s3.amazonaws.com/) or path style URLs (e.g. https://s3.amazonaws.com/bucket/) for S3 objects.")
|
||||||
|
.addDropdown((dropdown) => {
|
||||||
|
dropdown.addOption("virtualHostedStyle", "Virtual Hosted Style");
|
||||||
|
dropdown.addOption("pathStyle", "Path Style");
|
||||||
|
dropdown
|
||||||
|
.setValue(this.plugin.settings.s3.forcePathStyle ? "pathStyle": "virtualHostedStyle")
|
||||||
|
.onChange(async (val: string) => {
|
||||||
|
this.plugin.settings.s3.forcePathStyle = (val == "pathStyle");
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
new Setting(s3Div)
|
new Setting(s3Div)
|
||||||
.setName("check connectivity")
|
.setName("check connectivity")
|
||||||
.setDesc("check connectivity")
|
.setDesc("check connectivity")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user