feat: add structured pino logging and validated log-level config

This commit is contained in:
Codex
2026-02-18 13:16:35 +00:00
parent 6b1f9cddbc
commit e3f9a3574e
6 changed files with 74 additions and 8 deletions

View File

@@ -22,6 +22,7 @@ function strFromEnv(name, fallback) {
const parsed = {
port: intFromEnv("PORT", 3000),
stateFilePath: strFromEnv("STATE_FILE_PATH", "./data/state.json"),
logLevel: strFromEnv("LOG_LEVEL", "info"),
xWebhookSecret: process.env.X_WEBHOOK_SECRET || "dev-x-secret",
polarWebhookSecret: process.env.POLAR_WEBHOOK_SECRET || "dev-polar-secret",
rateLimits: {
@@ -41,6 +42,7 @@ const parsed = {
const ConfigSchema = z.object({
port: z.number().int().positive(),
stateFilePath: z.string().min(1),
logLevel: z.enum(["fatal", "error", "warn", "info", "debug", "trace", "silent"]),
xWebhookSecret: z.string().min(1),
polarWebhookSecret: z.string().min(1),
rateLimits: z.object({