{"id":20657740,"url":"https://github.com/boltops-tools/gcp_data","last_synced_at":"2025-08-20T23:11:57.937Z","repository":{"id":45253079,"uuid":"263475148","full_name":"boltops-tools/gcp_data","owner":"boltops-tools","description":"GCP Data: Simple library to get current project and region","archived":false,"fork":false,"pushed_at":"2021-12-27T23:10:47.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-26T08:59:18.728Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boltops-tools.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-12T23:24:34.000Z","updated_at":"2021-12-27T23:10:45.000Z","dependencies_parsed_at":"2022-08-30T17:10:49.601Z","dependency_job_id":null,"html_url":"https://github.com/boltops-tools/gcp_data","commit_stats":null,"previous_names":["tongueroo/gcp_data"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/boltops-tools/gcp_data","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boltops-tools%2Fgcp_data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boltops-tools%2Fgcp_data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boltops-tools%2Fgcp_data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boltops-tools%2Fgcp_data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boltops-tools","download_url":"https://codeload.github.com/boltops-tools/gcp_data/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boltops-tools%2Fgcp_data/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271400259,"owners_count":24752830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T18:22:42.919Z","updated_at":"2025-08-20T23:11:57.907Z","avatar_url":"https://github.com/boltops-tools.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GcpData\n\nSimple library to get current gcp data like project and region.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'gcp_data'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install gcp_data\n\nThis library can rely on the `gcloud` command, so it should be installed.\n\n## Usage\n\n```ruby\nGcpData.project\nGcpData.region\n```\n\n## Precedence\n\nThis library will return project and region info using different sources with this precedence:\n\n1. Environment variables: GOOGLE_PROJECT, GOOGLE_REGION, GOOGLE_ZONE\n2. Google Credentials file: only project id available from the GOOGLE\\_APPLICATION_CREDENTIALS file\n3. CLI: gcloud: project, region, and zone available\n4. Defaults: region=us-central1 and zone==us-central1a\n\n### 1. Environment variables\n\nThe environment variables take the highest precedence: GOOGLE_PROJECT, GOOGLE_REGION, GOOGLE_ZONE\n\n### 2. Google credentials file\n\nYou can also authenticate to the Google API by setting a GOOGLE\\_APPLICATION_CREDENTIALS env var that points to file a JSON file on your system. Example: `GOOGLE_APPLICATION_CREDENTIALS=~/.gcp/credentials.json`. More info at google docs: [Getting Started with Authentication](https://cloud.google.com/docs/authentication/getting-started).\n\nThis file contains a project_id key. So if you have set the GOOGLE\\_APPLICATION_CREDENTIALS and not set the GOOGLE_PROJECT var, then this library will use the project_id from the GOOGLE\\_APPLICATION_CREDENTIALS file.\n\n### 3. CLI: gcloud\n\nThe gcloud cli can also be used to set and get google project and region info. Here's a cheatsheet of the commands:\n\n    gcloud config list\n    gcloud config set project project-123\n    gcloud config set compute/region us-central1\n    gcloud config set compute/zone us-central1-b\n\nThe commands saves to a file in ~/.config/gcloud. The file looks something like this:\n\n~/.config/gcloud/configurations/config_default\n\n    [core]\n    project = project-12345\n\n    [compute]\n    region = us-central1\n    zone   = us-central1-a\n\n### 4. Defaults\n\nThe library will fall back to default values when it's unable to lookup the region and zone. The default values are:\n\n    region=us-central1\n    zone==us-central1a\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/boltops-tools/gcp_data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboltops-tools%2Fgcp_data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboltops-tools%2Fgcp_data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboltops-tools%2Fgcp_data/lists"}