mirror of
https://github.com/rclone/rclone.git
synced 2025-01-03 21:09:18 +01:00
gcs: add --gcs-endpoint flag and config parameter
See: https://forum.rclone.org/t/how-to-modify-google-cloud-storage-endpoint-uri/32342
This commit is contained in:
parent
0501773db1
commit
1ad22b8881
@ -319,6 +319,10 @@ can't check the size and hash but the file contents will be decompressed.
|
|||||||
`,
|
`,
|
||||||
Advanced: true,
|
Advanced: true,
|
||||||
Default: false,
|
Default: false,
|
||||||
|
}, {
|
||||||
|
Name: "endpoint",
|
||||||
|
Help: "Endpoint for the service.\n\nLeave blank normally.",
|
||||||
|
Advanced: true,
|
||||||
}, {
|
}, {
|
||||||
Name: config.ConfigEncoding,
|
Name: config.ConfigEncoding,
|
||||||
Help: config.ConfigEncodingHelp,
|
Help: config.ConfigEncodingHelp,
|
||||||
@ -343,6 +347,7 @@ type Options struct {
|
|||||||
StorageClass string `config:"storage_class"`
|
StorageClass string `config:"storage_class"`
|
||||||
NoCheckBucket bool `config:"no_check_bucket"`
|
NoCheckBucket bool `config:"no_check_bucket"`
|
||||||
Decompress bool `config:"decompress"`
|
Decompress bool `config:"decompress"`
|
||||||
|
Endpoint string `config:"endpoint"`
|
||||||
Enc encoder.MultiEncoder `config:"encoding"`
|
Enc encoder.MultiEncoder `config:"encoding"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,7 +528,11 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
|||||||
|
|
||||||
// Create a new authorized Drive client.
|
// Create a new authorized Drive client.
|
||||||
f.client = oAuthClient
|
f.client = oAuthClient
|
||||||
f.svc, err = storage.NewService(context.Background(), option.WithHTTPClient(f.client))
|
gcsOpts := []option.ClientOption{option.WithHTTPClient(f.client)}
|
||||||
|
if opt.Endpoint != "" {
|
||||||
|
gcsOpts = append(gcsOpts, option.WithEndpoint(opt.Endpoint))
|
||||||
|
}
|
||||||
|
f.svc, err = storage.NewService(context.Background(), gcsOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("couldn't create Google Cloud Storage client: %w", err)
|
return nil, fmt.Errorf("couldn't create Google Cloud Storage client: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user