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
2 changed files with 4 additions and 4 deletions
|
@ -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 a new issue