feat: add webhook-first app router with wallet, job, and unlock endpoints

This commit is contained in:
Codex
2026-02-18 12:36:05 +00:00
parent a7526e12ec
commit fedab9f7bd
3 changed files with 367 additions and 0 deletions

28
src/config.js Normal file
View File

@@ -0,0 +1,28 @@
"use strict";
function intFromEnv(name, fallback) {
const raw = process.env[name];
if (!raw) {
return fallback;
}
const parsed = Number.parseInt(raw, 10);
return Number.isInteger(parsed) ? parsed : fallback;
}
const config = {
port: intFromEnv("PORT", 3000),
xWebhookSecret: process.env.X_WEBHOOK_SECRET || "dev-x-secret",
polarWebhookSecret: process.env.POLAR_WEBHOOK_SECRET || "dev-polar-secret",
credit: {
baseCredits: intFromEnv("BASE_CREDITS", 1),
includedChars: intFromEnv("INCLUDED_CHARS", 25000),
stepChars: intFromEnv("STEP_CHARS", 10000),
stepCredits: intFromEnv("STEP_CREDITS", 1),
maxCharsPerArticle: intFromEnv("MAX_CHARS_PER_ARTICLE", 120000),
},
};
module.exports = {
config,
};