Skip to content

Instantly share code, notes, and snippets.

@sejidjorge
Created June 27, 2025 04:25
Show Gist options
  • Select an option

  • Save sejidjorge/5b04a382e5bd2943205dedbe01d71ea4 to your computer and use it in GitHub Desktop.

Select an option

Save sejidjorge/5b04a382e5bd2943205dedbe01d71ea4 to your computer and use it in GitHub Desktop.
Exemple save Google key json
GOOGLE_SERVICE_ACCOUNT_JSON={"type":"service_account","project_id":"my-project-id",...}
// Copy this entire JSON as a minified string
// Load the service account JSON from environment variable
const serviceAccountJson = process.env.GOOGLE_SERVICE_ACCOUNT_JSON;
if (!serviceAccountJson) {
// Throw an error if the env variable is not set
throw new Error("Missing GOOGLE_SERVICE_ACCOUNT_JSON env variable");
}
// Parse the JSON string into a JavaScript object
export const googleServiceAccount = JSON.parse(serviceAccountJson);
{
"type": "service_account",
"project_id": "my-project-id",
"private_key_id": "abc123",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIE...\n-----END PRIVATE KEY-----\n",
"client_email": "my-service-account@my-project-id.iam.gserviceaccount.com",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment