mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-22 19:23:36 +00:00
Add minios:// for minio servers with SSL support
This commit is contained in:
@@ -23,7 +23,8 @@ type S3Storage struct {
|
||||
|
||||
// CreateS3Storage creates a amazon s3 storage object.
|
||||
func CreateS3Storage(regionName string, endpoint string, bucketName string, storageDir string,
|
||||
accessKey string, secretKey string, threads int, isMinioCompatible bool) (storage *S3Storage, err error) {
|
||||
accessKey string, secretKey string, threads int,
|
||||
isSSLSupported bool, isMinioCompatible bool) (storage *S3Storage, err error) {
|
||||
|
||||
token := ""
|
||||
|
||||
@@ -54,7 +55,7 @@ func CreateS3Storage(regionName string, endpoint string, bucketName string, stor
|
||||
Credentials: auth,
|
||||
Endpoint: aws.String(endpoint),
|
||||
S3ForcePathStyle: aws.Bool(isMinioCompatible),
|
||||
DisableSSL: aws.Bool(isMinioCompatible),
|
||||
DisableSSL: aws.Bool(!isSSLSupported),
|
||||
}
|
||||
|
||||
if len(storageDir) > 0 && storageDir[len(storageDir) - 1] != '/' {
|
||||
|
||||
@@ -293,7 +293,7 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor
|
||||
SavePassword(preference, "ssh_password", password)
|
||||
}
|
||||
return sftpStorage
|
||||
} else if matched[1] == "s3" || matched[1] == "s3c" || matched[1] == "minio"{
|
||||
} else if matched[1] == "s3" || matched[1] == "s3c" || matched[1] == "minio" || matched[1] == "minios" {
|
||||
|
||||
// urlRegex := regexp.MustCompile(`^(\w+)://([\w\-]+@)?([^/]+)(/(.+))?`)
|
||||
|
||||
@@ -328,8 +328,9 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
isMinioCompatible := matched[1] == "minio"
|
||||
storage, err = CreateS3Storage(region, endpoint, bucket, storageDir, accessKey, secretKey, threads, isMinioCompatible)
|
||||
isMinioCompatible := (matched[1] == "minio" || matched[1] == "minios")
|
||||
isSSLSupported := (matched[1] == "s3" || matched[1] == "minios")
|
||||
storage, err = CreateS3Storage(region, endpoint, bucket, storageDir, accessKey, secretKey, threads, isSSLSupported, isMinioCompatible)
|
||||
if err != nil {
|
||||
LOG_ERROR("STORAGE_CREATE", "Failed to load the S3 storage at %s: %v", storageURL, err)
|
||||
return nil
|
||||
|
||||
@@ -65,17 +65,17 @@ func loadStorage(localStoragePath string, threads int) (Storage, error) {
|
||||
port, _ := strconv.Atoi(storage["port"])
|
||||
return CreateSFTPStorageWithPassword(storage["server"], port, storage["username"], storage["directory"], storage["password"], threads)
|
||||
} else if testStorageName == "s3" {
|
||||
return CreateS3Storage(storage["region"], storage["endpoint"], storage["bucket"], storage["directory"], storage["access_key"], storage["secret_key"], threads, false)
|
||||
return CreateS3Storage(storage["region"], storage["endpoint"], storage["bucket"], storage["directory"], storage["access_key"], storage["secret_key"], threads, true, false)
|
||||
} else if testStorageName == "s3c" {
|
||||
return CreateS3CStorage(storage["region"], storage["endpoint"], storage["bucket"], storage["directory"], storage["access_key"], storage["secret_key"], threads)
|
||||
} else if testStorageName == "minio" {
|
||||
return CreateS3Storage(storage["region"], storage["endpoint"], storage["bucket"], storage["directory"], storage["access_key"], storage["secret_key"], threads, true)
|
||||
return CreateS3Storage(storage["region"], storage["endpoint"], storage["bucket"], storage["directory"], storage["access_key"], storage["secret_key"], threads, false, true)
|
||||
} else if testStorageName == "dropbox" {
|
||||
return CreateDropboxStorage(storage["token"], storage["directory"], threads)
|
||||
} else if testStorageName == "b2" {
|
||||
return CreateB2Storage(storage["account"], storage["key"], storage["bucket"], threads)
|
||||
} else if testStorageName == "gcs-s3" {
|
||||
return CreateS3Storage(storage["region"], storage["endpoint"], storage["bucket"], storage["directory"], storage["access_key"], storage["secret_key"], threads, false)
|
||||
return CreateS3Storage(storage["region"], storage["endpoint"], storage["bucket"], storage["directory"], storage["access_key"], storage["secret_key"], threads, true, false)
|
||||
} else if testStorageName == "gcs" {
|
||||
return CreateGCSStorage(storage["token_file"], storage["bucket"], storage["directory"], threads)
|
||||
} else if testStorageName == "gcs-sa" {
|
||||
|
||||
Reference in New Issue
Block a user