Skip to content

Commit

Permalink
Removed else block for client
Browse files Browse the repository at this point in the history
Signed-off-by: Brad Wadsworth <brad.wadsworth@mavenwave.com>
  • Loading branch information
Brad Wadsworth committed Sep 28, 2022
1 parent 0264cbc commit f2026ed
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pkg/clients/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,17 @@ func UseProviderConfig(ctx context.Context, c client.Client, mg resource.Managed
}
if isJSON(data) {
opts = append(opts, option.WithCredentialsJSON(data))
} else {
t := oauth2.Token{
AccessToken: string(data),
}
if ok := t.Valid(); !ok {
return pc.Spec.ProjectID, opts, errors.New("Access token invalid")
}
ts := oauth2.StaticTokenSource(&t)
opts = append(opts, option.WithTokenSource(ts))
return pc.Spec.ProjectID, opts, nil
}
t := oauth2.Token{
AccessToken: string(data),
}
if ok := t.Valid(); !ok {
return pc.Spec.ProjectID, opts, errors.New("Access token invalid")
}
ts := oauth2.StaticTokenSource(&t)
opts = append(opts, option.WithTokenSource(ts))

}
return pc.Spec.ProjectID, opts, nil
}
Expand Down

0 comments on commit f2026ed

Please # to comment.