forked from TrueCloudLab/rclone
swift: make it so just storage_url or auth_token can be overidden
Before this change if only one of storage_url or auth_token were supplied then rclone would overwrite both of them when authenticating. This effectively meant you could supply both of them or none of them only. Now rclone still does the authentication to read the missing storage_url or auth_token then afterwards re-writes the auth_token or storage_url back to what the user desired. Fixes #2464
This commit is contained in:
parent
b3217d2cac
commit
842ed7d2a9
1 changed files with 9 additions and 0 deletions
|
@ -277,6 +277,15 @@ func swiftConnection(opt *Options, name string) (*swift.Connection, error) {
|
|||
// provided by wrapping the existing auth, so we can just
|
||||
// override one or the other or both.
|
||||
if StorageUrl != "" || AuthToken != "" {
|
||||
// Re-write StorageURL and AuthToken if they are being
|
||||
// overridden as c.Authenticate above will have
|
||||
// overwritten them.
|
||||
if StorageUrl != "" {
|
||||
c.StorageUrl = StorageUrl
|
||||
}
|
||||
if AuthToken != "" {
|
||||
c.AuthToken = AuthToken
|
||||
}
|
||||
c.Auth = newAuth(c.Auth, StorageUrl, AuthToken)
|
||||
}
|
||||
return c, nil
|
||||
|
|
Loading…
Reference in a new issue