{"id":20141251,"url":"https://github.com/alekcz/google-credentials","last_synced_at":"2026-03-04T23:31:57.541Z","repository":{"id":57713111,"uuid":"237077268","full_name":"alekcz/google-credentials","owner":"alekcz","description":"A Clojure library for loading gcloud credentials from an environment variable instead of a .json file","archived":false,"fork":false,"pushed_at":"2020-05-15T11:09:10.000Z","size":45,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-20T22:35:37.068Z","etag":null,"topics":["google","google-cloud"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alekcz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-29T20:37:14.000Z","updated_at":"2024-05-14T13:30:15.000Z","dependencies_parsed_at":"2022-09-05T22:50:17.224Z","dependency_job_id":null,"html_url":"https://github.com/alekcz/google-credentials","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alekcz/google-credentials","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekcz%2Fgoogle-credentials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekcz%2Fgoogle-credentials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekcz%2Fgoogle-credentials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekcz%2Fgoogle-credentials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alekcz","download_url":"https://codeload.github.com/alekcz/google-credentials/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekcz%2Fgoogle-credentials/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30099380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T23:31:22.529Z","status":"ssl_error","status_checked_at":"2026-03-04T23:31:22.112Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["google","google-cloud"],"created_at":"2024-11-13T21:56:50.480Z","updated_at":"2026-03-04T23:31:57.460Z","avatar_url":"https://github.com/alekcz.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# google-credentials\n\nA Clojure library for loading gcloud credentials from an environment variable instead of a .json file.\n\n![Build Status](https://github.com/alekcz/google-credentials/workflows/Clojure%20CI/badge.svg) [![codecov](https://codecov.io/gh/alekcz/google-credentials/branch/master/graph/badge.svg)](https://codecov.io/gh/alekcz/google-credentials)  \n\n[![Clojars Project](https://img.shields.io/clojars/v/alekcz/googlecredentials.svg)](https://clojars.org/alekcz/googlecredentials)\n\n## Background\n\nWhen interoping with the Google SDK the initialization process is more or less as follows:\n1. Load credentials from file\n2. Initialize credentials\n3. Initialize the SDK by passing the credentials to it.\n4. Access resource in the Google cloud\n\nThis library allows the credentials to be loaded from the environment variable: `GOOGLE_APPLICATION_CREDENTIALS`.  \nYou can also load the credentials from a custom environment variable.\nI've found this really useful when deploying applications or running CI/CD outside the Google cloud. \n\nYou still need to perform steps 2 - 4 to get up and running. \n\n## Usage\n    \n**Current:** `[alekcz/googlecredentials \"3.0.1\"]`   \n\n_Deprecated: `[alekcz/google-credentials \"x.x.x\"]`_   \n_(The dash in the package name creates problems)_\n\n1. Get the `json` file containing your service account creditials by following the instruction here [https://cloud.google.com/docs/authentication/getting-started](https://cloud.google.com/docs/authentication/getting-started)  \n2. Copy the contents of your `.json` into the GOOGLE_APPLICATION_CREDENTIALS environment variable. In your `~/.bash_profile` and in Travis CI you should escape your credentials using singe quotes (`'`).\n\n```clojure\n(require '[googlecredentials.core :as g-cred])\n\n    ;; By default load from GOOGLE_APPLICATION_CREDENTIALS\n    (-\u003e (. StorageOptions newBuilder)\n        (.setCredentials (g-cred/load-service-credentials)) \n        (.build) \n        (.getService))\n\n    ;; Load from custom environment variable\n    (def firebase-options   (-\u003e (new FirebaseOptions$Builder) \n                                (.setCredentials (g-cred/load-service-credentials :firebase-config)) \n                                (.build))   \n    (.initializeApp FirebaseApp firebase-options)   \n\n    ;; Load from custom environment variable as string\n    (def firebase-options   (-\u003e (new FirebaseOptions$Builder) \n                                (.setCredentials (g-cred/load-service-credentials \"FIREBASE_CONFIG\")) \n                                (.build))   \n    (.initializeApp FirebaseApp firebase-options)   \n\n     ;; generic example\n    (def cred   (-\u003e (\u003coptions-builder\u003e)\n                    (.setCredentials (g-cred/load-service-credentials)) \n                    (.build))  \n    (\u003ccloud-library\u003e/\u003cinitialisation-function\u003e cred)\n\n```\n\n## License\n\nCopyright © 2020 Alexander Oloo\n\nThis program and the accompanying materials are made available under the\nterms of the Eclipse Public License 2.0 which is available at\nhttp://www.eclipse.org/legal/epl-2.0.\n\nThis Source Code may also be made available under the following Secondary\nLicenses when the conditions for such availability set forth in the Eclipse\nPublic License, v. 2.0 are satisfied: GNU General Public License as published by\nthe Free Software Foundation, either version 2 of the License, or (at your\noption) any later version, with the GNU Classpath Exception which is available\nat https://www.gnu.org/software/classpath/license.html.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falekcz%2Fgoogle-credentials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falekcz%2Fgoogle-credentials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falekcz%2Fgoogle-credentials/lists"}