mirror of
https://github.com/restic/restic.git
synced 2026-11-25 15:17:50 +00:00
s3: properly integrate minio-go lib
This commit is contained in:
1 parent
2c15597e24
commit
407819e5a9
5 files changed
+81
-43
No files matched your search
+10
-8
@@ -9,8 +9,8 @@ import (
|
||||
// Config contains all configuration necessary to connect to an s3 compatible
|
||||
// server.
|
||||
type Config struct {
|
||||
Region string
|
||||
URL string
|
||||
Endpoint string
|
||||
UseHTTP bool
|
||||
KeyID, Secret string
|
||||
Bucket string
|
||||
}
|
||||
@@ -28,8 +28,8 @@ func ParseConfig(s string) (interface{}, error) {
|
||||
}
|
||||
|
||||
cfg := Config{
|
||||
Region: data[0],
|
||||
Bucket: data[1],
|
||||
Endpoint: data[0],
|
||||
Bucket: data[1],
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
@@ -55,7 +55,7 @@ func ParseConfig(s string) (interface{}, error) {
|
||||
if len(rest) == 2 {
|
||||
// assume that just a region name and a bucket has been specified, in
|
||||
// the format region/bucket
|
||||
cfg.Region = rest[0]
|
||||
cfg.Endpoint = rest[0]
|
||||
cfg.Bucket = rest[1]
|
||||
} else {
|
||||
// assume that a URL has been specified, parse it and use the path as
|
||||
@@ -69,10 +69,12 @@ func ParseConfig(s string) (interface{}, error) {
|
||||
return nil, errors.New("s3: bucket name not found")
|
||||
}
|
||||
|
||||
cfg.Bucket = url.Path[1:]
|
||||
url.Path = ""
|
||||
cfg.Endpoint = url.Host
|
||||
if url.Scheme == "http" {
|
||||
cfg.UseHTTP = true
|
||||
}
|
||||
|
||||
cfg.URL = url.String()
|
||||
cfg.Bucket = url.Path[1:]
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
|
||||
Reference in new issue
Block a user