diff --git a/make_cred.mjs b/make_cred.mjs deleted file mode 100755 index 0600b45..0000000 --- a/make_cred.mjs +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env node -import { readFileSync, writeFileSync } from "node:fs"; -import { parseArgs } from "node:util"; - -const { values } = parseArgs({ - options: { - "private-key-file": { type: "string" }, - "client-email": { type: "string" }, - output: { type: "string", default: "cred.json" }, - }, -}); - -if (!values["private-key-file"] || !values["client-email"]) { - console.error("Usage: make_cred.mjs --private-key-file FILE --client-email EMAIL [--output FILE]"); - process.exit(1); -} - -const privateKey = readFileSync(values["private-key-file"], "utf8"); -const clientEmail = values["client-email"]; - -const cred = { - type: "service_account", - project_id: clientEmail.split("@")[1].split(".")[0], - private_key: privateKey, - client_email: clientEmail, - token_uri: "https://oauth2.googleapis.com/token", -}; - -writeFileSync(values.output, JSON.stringify(cred, null, 2) + "\n");