mirror of
https://github.com/blackboxprogramming/alexa-amundson-resume.git
synced 2026-03-18 06:34:09 -05:00
Replace documentation-only repo with working code: - Stripe integration: webhook handler (8 event types), billing API (customers, checkout, payments, subscriptions, invoices) - Express API server with health endpoint, structured logging - E2E tests (Playwright): health, webhook signature verification, billing API validation - Unit tests: webhook event handler coverage for all event types - Pi deployment: deploy.sh (rsync + systemd), NGINX load balancer across Pi cluster, Docker support - CI/CD: test workflow, Pi deploy workflow, updated auto-deploy and self-healing to run real tests before deploying - Move resume docs to docs/ to separate code from documentation https://claude.ai/code/session_01Mf5Pg82fV6BTRS9GnpV7nr
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
const { resolve } = require('path');
|
|
|
|
// Load .env from project root if present
|
|
require('dotenv').config({ path: resolve(__dirname, '../../.env') });
|
|
|
|
const config = {
|
|
port: parseInt(process.env.PORT, 10) || 3000,
|
|
env: process.env.NODE_ENV || 'development',
|
|
logLevel: process.env.LOG_LEVEL || 'info',
|
|
|
|
stripe: {
|
|
secretKey: process.env.STRIPE_SECRET_KEY,
|
|
publishableKey: process.env.STRIPE_PUBLISHABLE_KEY,
|
|
webhookSecret: process.env.STRIPE_WEBHOOK_SECRET,
|
|
},
|
|
|
|
pi: {
|
|
hosts: [
|
|
process.env.PI_HOST_1,
|
|
process.env.PI_HOST_2,
|
|
process.env.PI_HOST_3,
|
|
].filter(Boolean),
|
|
user: process.env.PI_USER || 'pi',
|
|
deployPath: process.env.PI_DEPLOY_PATH || '/opt/blackroad',
|
|
sshKey: process.env.PI_SSH_KEY || '~/.ssh/id_ed25519',
|
|
},
|
|
|
|
deployUrl: process.env.DEPLOY_URL || 'http://localhost:3000',
|
|
};
|
|
|
|
function validateConfig() {
|
|
const missing = [];
|
|
if (!config.stripe.secretKey) missing.push('STRIPE_SECRET_KEY');
|
|
if (!config.stripe.webhookSecret) missing.push('STRIPE_WEBHOOK_SECRET');
|
|
|
|
if (missing.length > 0 && config.env === 'production') {
|
|
throw new Error(`Missing required env vars: ${missing.join(', ')}`);
|
|
}
|
|
|
|
if (missing.length > 0) {
|
|
console.warn(`[config] Missing env vars (non-production): ${missing.join(', ')}`);
|
|
}
|
|
}
|
|
|
|
module.exports = { config, validateConfig };
|