Browse Source

feat: S3 备份账号支持 Path Style (#6489)

Refs #4553
pull/6491/head
ssongliu 2 months ago committed by GitHub
parent
commit
0e6fdffeec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      backend/utils/cloud_storage/client/s3.go
  2. 1
      frontend/src/lang/modules/en.ts
  3. 1
      frontend/src/lang/modules/tw.ts
  4. 1
      frontend/src/lang/modules/zh.ts
  5. 2
      frontend/src/views/setting/backup-account/cos/index.vue
  6. 2
      frontend/src/views/setting/backup-account/kodo/index.vue
  7. 2
      frontend/src/views/setting/backup-account/minio/index.vue
  8. 2
      frontend/src/views/setting/backup-account/oss/index.vue
  9. 13
      frontend/src/views/setting/backup-account/s3/index.vue

6
backend/utils/cloud_storage/client/s3.go

@ -27,12 +27,16 @@ func NewS3Client(vars map[string]interface{}) (*s3Client, error) {
if len(scType) == 0 {
scType = "Standard"
}
mode := loadParamFromVars("mode", vars)
if len(mode) == 0 {
mode = "virtual hosted"
}
sess, err := session.NewSession(&aws.Config{
Credentials: credentials.NewStaticCredentials(accessKey, secretKey, ""),
Endpoint: aws.String(endpoint),
Region: aws.String(region),
DisableSSL: aws.Bool(true),
S3ForcePathStyle: aws.Bool(false),
S3ForcePathStyle: aws.Bool(mode == "path"),
})
if err != nil {
return nil, err

1
frontend/src/lang/modules/en.ts

@ -1410,6 +1410,7 @@ const message = {
LOCAL: 'Server Disks',
OSS: 'Ali OSS',
S3: 'Amazon S3',
mode: 'Mode',
MINIO: 'MINIO',
SFTP: 'SFTP',
WebDAV: 'WebDAV',

1
frontend/src/lang/modules/tw.ts

@ -1323,6 +1323,7 @@ const message = {
LOCAL: '服務器磁盤',
OSS: '阿裏雲 OSS',
S3: '亞馬遜 S3 雲存儲',
mode: '模式',
MINIO: 'MINIO',
SFTP: 'SFTP',
WebDAV: 'WebDAV',

1
frontend/src/lang/modules/zh.ts

@ -1327,6 +1327,7 @@ const message = {
LOCAL: '服务器磁盘',
OSS: '阿里云 OSS',
S3: '亚马逊 S3 云存储',
mode: '模式',
MINIO: 'MINIO',
SFTP: 'SFTP',
WebDAV: 'WebDAV',

2
frontend/src/views/setting/backup-account/cos/index.vue

@ -47,7 +47,7 @@
<el-form-item label="Endpoint" prop="varsJson.endpointItem" :rules="Rules.requiredInput">
<el-input v-model.trim="cosData.rowData!.varsJson['endpointItem']">
<template #prepend>
<el-select v-model.trim="endpointProto" style="width: 100px">
<el-select v-model.trim="endpointProto" style="width: 120px">
<el-option label="http" value="http" />
<el-option label="https" value="https" />
</el-select>

2
frontend/src/views/setting/backup-account/kodo/index.vue

@ -29,7 +29,7 @@
>
<el-input v-model="kodoData.rowData!.varsJson['domainItem']">
<template #prepend>
<el-select v-model.trim="domainProto" style="width: 100px">
<el-select v-model.trim="domainProto" style="width: 120px">
<el-option label="http" value="http" />
<el-option label="https" value="https" />
</el-select>

2
frontend/src/views/setting/backup-account/minio/index.vue

@ -25,7 +25,7 @@
<el-form-item label="Endpoint" prop="varsJson.endpointItem" :rules="Rules.requiredInput">
<el-input v-model="minioData.rowData!.varsJson['endpointItem']">
<template #prepend>
<el-select v-model.trim="endpointProto" style="width: 100px">
<el-select v-model.trim="endpointProto" style="width: 120px">
<el-option label="http" value="http" />
<el-option label="https" value="https" />
</el-select>

2
frontend/src/views/setting/backup-account/oss/index.vue

@ -25,7 +25,7 @@
<el-form-item label="Endpoint" prop="varsJson.endpointItem" :rules="Rules.requiredInput">
<el-input v-model="ossData.rowData!.varsJson['endpointItem']">
<template #prepend>
<el-select v-model.trim="endpointProto" style="width: 100px">
<el-select v-model.trim="endpointProto" style="width: 120px">
<el-option label="http" value="http" />
<el-option label="https" value="https" />
</el-select>

13
frontend/src/views/setting/backup-account/s3/index.vue

@ -16,6 +16,12 @@
<el-form-item :label="$t('commons.table.type')" prop="type" :rules="Rules.requiredSelect">
<el-tag>{{ $t('setting.' + s3Data.rowData!.type) }}</el-tag>
</el-form-item>
<el-form-item :label="$t('setting.mode')" prop="varsJson.mode" :rules="Rules.requiredSelect">
<el-radio-group v-model="s3Data.rowData!.varsJson['mode']">
<el-radio value="virtual hosted">Virtual Hosted</el-radio>
<el-radio value="path">Path</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="Access Key ID" prop="accessKey" :rules="Rules.requiredInput">
<el-input v-model.trim="s3Data.rowData!.accessKey" />
</el-form-item>
@ -28,7 +34,7 @@
<el-form-item label="Endpoint" prop="varsJson.endpointItem" :rules="Rules.requiredInput">
<el-input v-model="s3Data.rowData!.varsJson['endpointItem']">
<template #prepend>
<el-select v-model.trim="endpointProto" style="width: 100px">
<el-select v-model="endpointProto" style="width: 120px">
<el-option label="http" value="http" />
<el-option label="https" value="https" />
</el-select>
@ -117,9 +123,12 @@ const s3Data = ref<DialogProps>({
const acceptParams = (params: DialogProps): void => {
buckets.value = [];
s3Data.value = params;
if (params.title === 'create' || (params.title === 'edit' && !s3Data.value.rowData.varsJson['scType'])) {
if (!s3Data.value.rowData.varsJson['scType']) {
s3Data.value.rowData.varsJson['scType'] = 'STANDARD';
}
if (!s3Data.value.rowData.varsJson['mode']) {
s3Data.value.rowData.varsJson['mode'] = 'virtual hosted';
}
if (s3Data.value.title === 'edit') {
let httpItem = splitHttp(s3Data.value.rowData!.varsJson['endpoint']);
s3Data.value.rowData!.varsJson['endpointItem'] = httpItem.url;

Loading…
Cancel
Save