mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 03:07:20 +08:00
fix: lint
This commit is contained in:
@@ -400,6 +400,7 @@ func (r *backupRepo) getStorage(backupStorage biz.BackupStorage) (storage.Storag
|
||||
return storage.NewLocal(backupStorage.Info.Path)
|
||||
case biz.BackupStorageTypeS3:
|
||||
return storage.NewS3(storage.S3Config{
|
||||
Region: backupStorage.Info.Region,
|
||||
Bucket: backupStorage.Info.Bucket,
|
||||
AccessKeyID: backupStorage.Info.AccessKey,
|
||||
SecretAccessKey: backupStorage.Info.SecretKey,
|
||||
|
||||
@@ -124,6 +124,7 @@ func (s *BackupStorageService) validateStorage(accountType string, info types.Ba
|
||||
switch biz.BackupStorageType(accountType) {
|
||||
case biz.BackupStorageTypeS3:
|
||||
client, err = storage.NewS3(storage.S3Config{
|
||||
Region: info.Region,
|
||||
Bucket: info.Bucket,
|
||||
AccessKeyID: info.AccessKey,
|
||||
SecretAccessKey: info.SecretKey,
|
||||
|
||||
9
pkg/storage/s3_test.go
Normal file
9
pkg/storage/s3_test.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package storage
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestS3(t *testing.T) {
|
||||
s3, err := NewS3(S3Config{
|
||||
Region: "us-west-1",
|
||||
})
|
||||
}
|
||||
@@ -7,6 +7,7 @@ type BackupStorageInfo struct {
|
||||
AccessKey string `json:"access_key"` // 访问密钥
|
||||
SecretKey string `json:"secret_key"` // 私钥
|
||||
Style string `json:"style" validate:"required|in:path,virtual-hosted"` // virtual-hosted, path
|
||||
Region string `json:"region"` // 地区
|
||||
Endpoint string `json:"endpoint" validate:"required"` // 端点
|
||||
Scheme string `json:"scheme" validate:"required|in:http,https"` // http, https
|
||||
Bucket string `json:"bucket" validate:"required"` // 存储桶
|
||||
|
||||
@@ -37,7 +37,8 @@ const defaultModel = {
|
||||
info: {
|
||||
access_key: '',
|
||||
secret_key: '',
|
||||
style: 'virtual_hosted',
|
||||
style: 'virtual-hosted',
|
||||
region: '',
|
||||
endpoint: '',
|
||||
scheme: 'https',
|
||||
bucket: '',
|
||||
@@ -246,6 +247,12 @@ onMounted(() => {
|
||||
<n-form-item :label="$gettext('Style')">
|
||||
<n-select v-model:value="createModel.info.style" :options="styleOptions" />
|
||||
</n-form-item>
|
||||
<n-form-item :label="$gettext('Region')">
|
||||
<n-input
|
||||
v-model:value="createModel.info.region"
|
||||
:placeholder="$gettext('Enter region (e.g., us-east-1)')"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item :label="$gettext('Endpoint')" required>
|
||||
<n-input
|
||||
v-model:value="createModel.info.endpoint"
|
||||
|
||||
Reference in New Issue
Block a user