diff --git a/backend/drive/drive.go b/backend/drive/drive.go index 5f733f9e3..14b24da27 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -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") + 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") diff --git a/backend/googlecloudstorage/googlecloudstorage.go b/backend/googlecloudstorage/googlecloudstorage.go index 0b77eb68b..c18cab6cb 100644 --- a/backend/googlecloudstorage/googlecloudstorage.go +++ b/backend/googlecloudstorage/googlecloudstorage.go @@ -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") + 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")