mirror of
https://github.com/rclone/rclone.git
synced 2024-12-23 15:38:57 +01:00
drive, gcs: fix service account authentication - fixes #2279
This fixes a problem introduced in b78af517de
where it would
attempt to read a non-existent service account file.
This commit is contained in:
parent
0daced29db
commit
a3bf6b9c2c
@ -464,8 +464,8 @@ func createOAuthClient(name string) (*http.Client, error) {
|
||||
|
||||
// try loading service account credentials from env variable, then from a file
|
||||
serviceAccountCreds := []byte(config.FileGet(name, "service_account_credentials"))
|
||||
if len(serviceAccountCreds) == 0 {
|
||||
serviceAccountPath := config.FileGet(name, "service_account_file")
|
||||
if len(serviceAccountCreds) == 0 && serviceAccountPath != "" {
|
||||
loadedCreds, err := ioutil.ReadFile(os.ExpandEnv(serviceAccountPath))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error opening service account credentials file")
|
||||
|
@ -293,8 +293,8 @@ func NewFs(name, root string) (fs.Fs, error) {
|
||||
|
||||
// try loading service account credentials from env variable, then from a file
|
||||
serviceAccountCreds := []byte(config.FileGet(name, "service_account_credentials"))
|
||||
if len(serviceAccountCreds) == 0 {
|
||||
serviceAccountPath := config.FileGet(name, "service_account_file")
|
||||
if len(serviceAccountCreds) == 0 && serviceAccountPath != "" {
|
||||
loadedCreds, err := ioutil.ReadFile(os.ExpandEnv(serviceAccountPath))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error opening service account credentials file")
|
||||
|
Loading…
Reference in New Issue
Block a user