Skip to content

Commit

Permalink
fix: Get the project_id from gcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
JamshedVesuna committed Mar 5, 2024
1 parent 1fbd326 commit 481ee3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/googleauth/credentials_loader.rb
Expand Up @@ -37,7 +37,7 @@ module CredentialsLoader
AWS_SESSION_TOKEN_VAR = "AWS_SESSION_TOKEN".freeze
GCLOUD_POSIX_COMMAND = "gcloud".freeze
GCLOUD_WINDOWS_COMMAND = "gcloud.cmd".freeze
GCLOUD_CONFIG_COMMAND = "config config-helper --format json --verbosity none".freeze
GCLOUD_CONFIG_COMMAND = "config config-helper --format json --verbosity none --quiet".freeze

CREDENTIALS_FILE_NAME = "application_default_credentials.json".freeze
NOT_FOUND_ERROR = "Unable to read the credential file specified by #{ENV_VAR}".freeze
Expand Down Expand Up @@ -146,7 +146,7 @@ def from_system_default_path scope = nil, options = {}
def load_gcloud_project_id
gcloud = GCLOUD_WINDOWS_COMMAND if OS.windows?
gcloud = GCLOUD_POSIX_COMMAND unless OS.windows?
gcloud_json = IO.popen("#{gcloud} #{GCLOUD_CONFIG_COMMAND}", in: :close, err: :close, &:read)
gcloud_json = IO.popen("#{gcloud} #{GCLOUD_CONFIG_COMMAND}", err: :close, &:read)
config = MultiJson.load gcloud_json
config["configuration"]["properties"]["core"]["project"]
rescue StandardError
Expand Down

0 comments on commit 481ee3f

Please sign in to comment.