This commit is contained in:
adueck 2024-03-02 23:13:11 -05:00
parent e0ef03a944
commit e09f3b7d14
2 changed files with 35 additions and 29 deletions

View File

@ -11,6 +11,7 @@ const names = [
"LINGDOCS_ACCOUNT_UPGRADE_PASSWORD",
"STRIPE_SECRET_KEY",
"STRIPE_WEBHOOK_SECRET",
"NTFY_TOPIC",
];
const values = names.map((name) => ({
@ -20,7 +21,10 @@ const values = names.map((name) => ({
const missing = values.filter((v) => !v.value);
if (missing.length) {
console.error("Missing evironment variable(s):", missing.map((m) => m.name).join(", "));
console.error(
"Missing evironment variable(s):",
missing.map((m) => m.name).join(", ")
);
process.exit(1);
}
@ -37,4 +41,5 @@ export default {
upgradePassword: values[9].value,
stripeSecretKey: values[10].value,
stripeWebhookSecret: values[11].value,
ntfyTopic: values[12].value,
};

View File

@ -1,7 +1,8 @@
import fetch from "node-fetch";
import envVars from "./env-vars";
export async function ntfy(message: string) {
fetch("https://ntfy.sh/uhrv932r4e5w6zmi4-ld", {
fetch(`https://ntfy.sh/${envVars.ntfyTopic}`, {
method: "POST",
body: message,
}).catch(console.error);