Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
JWT_SECRET: testsecret
PLATFORM_SECRET_KEY: SCVMQUS5EMTHWBLJTE5XCSCMHB2ZOVKRR4ATVTRPUNRCOGKRENIL3LHR
STELLAR_NETWORK: testnet
STELLAR_HORIZON_URL: https://horizon-testnet.stellar.org
USDC_ISSUER: GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5
ENABLE_CAMPAIGN_STATUS_CRON: 'false'
run: npm test
Expand Down Expand Up @@ -130,4 +131,8 @@ jobs:
env:
CI: true
DATABASE_URL: postgresql://postgres:password@localhost:5433/crowdpay
JWT_SECRET: testsecret
PLATFORM_SECRET_KEY: SCVMQUS5EMTHWBLJTE5XCSCMHB2ZOVKRR4ATVTRPUNRCOGKRENIL3LHR
STELLAR_NETWORK: testnet
STELLAR_HORIZON_URL: https://horizon-testnet.stellar.org
run: npm run test:e2e
4 changes: 2 additions & 2 deletions backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ PLATFORM_FEE_BPS=150
# ALERT_WEBHOOK_URL=https://hooks.slack.com/services/...

# Optional: UUID of the user who may approve/reject withdrawals as platform (JWT subject must match).
# When unset, any logged-in user may call# Platform User for Approvals (Optional)
PLATFORM_APPROVER_USER_ID=00000000-0000-0000-0000-000000000000
# When unset, any logged-in user may call the withdrawal approval endpoints (dev mode only).
# PLATFORM_APPROVER_USER_ID=00000000-0000-0000-0000-000000000000

# Email Configuration
EMAIL_FROM="CrowdPay" <noreply@crowdpay.local>
Expand Down
20 changes: 19 additions & 1 deletion backend/src/config/env.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const { validateWalletSecretConfig } = require('../services/walletSecrets');

const REQUIRED = ['JWT_SECRET', 'DATABASE_URL', 'PLATFORM_SECRET_KEY', 'STELLAR_NETWORK'];
const REQUIRED = [
'DATABASE_URL',
'JWT_SECRET',
'PLATFORM_SECRET_KEY',
'STELLAR_NETWORK',
'STELLAR_HORIZON_URL',
];
const STORAGE_VARS = ['STORAGE_BUCKET', 'STORAGE_ENDPOINT'];

function validateEnv() {
Expand Down Expand Up @@ -29,6 +35,18 @@ function validateEnv() {
process.stderr.write(`\n[crowdpay] Cannot start: ${err.message}\n\n`);
process.exit(1);
}

// Warn about important optional variables
if (!process.env.PLATFORM_APPROVER_USER_ID) {
process.stderr.write(
'[crowdpay] Warning: PLATFORM_APPROVER_USER_ID not set — withdrawal approvals are open to all users (dev mode)\n'
);
}
if (!process.env.JWT_EXPIRES_IN) {
process.stderr.write(
'[crowdpay] Warning: JWT_EXPIRES_IN not set — access tokens will use the default expiry (15m)\n'
);
}
}

module.exports = { validateEnv };
Loading