Added prototype files.

This commit is contained in:
slawek committed 2026-10-17 08:59:44 +02:00
commit feff0158e2
6 files changed
+146

No files matched your search

Executable
+29
View File
@@ -0,0 +1,29 @@
#!/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");