Skip to content

fix: add env var validation warnings and centralized config defaults - #1014

Open
praise-idise wants to merge 1 commit into
StellarDevHub:mainfrom
praise-idise:main
Open

fix: add env var validation warnings and centralized config defaults#1014
praise-idise wants to merge 1 commit into
StellarDevHub:mainfrom
praise-idise:main

Conversation

@praise-idise

Copy link
Copy Markdown

Closes #1001

Summary

The backend server silently defaulted critical environment variables
to localhost/testnet values without any warning. This adds clear
warning logs, SSL tracking, and replaces scattered inline fallbacks
with the centralized getEnvVar() utility.

Problem

  • REDIS_URLredis://localhost:6379 without warning
  • NODE_ENVdevelopment without warning
  • SOROBAN_RPC_URL → testnet without warning
  • STELLAR_NETWORK → testnet without warning
  • SSL_KEY_PATH / SSL_CERT_PATH → not tracked
  • Multiple files used their own inline process.env.X || 'fallback'

What Changed

File Change
src/utils/checkEnv.ts warnOnDefault flag, SSL vars, HTTPS status logging
src/utils/redis.ts Use centralized getEnvVar() instead of inline fallback
src/config/redis.config.ts Warning log on Redis config fallback
tests/checkEnv.test.ts 3 new tests + fix pre-existing test

Startup Output Example

⚠️  NODE_ENV is not set, defaulting to "development".
⚠️  STELLAR_NETWORK is not set, defaulting to "testnet".
⚠️  SOROBAN_RPC_URL is not set, defaulting to "https://soroban-testnet.stellar.org".
⚠️  REDIS_URL is not set, defaulting to redis://localhost:6379.
ℹ️  SSL_KEY_PATH and SSL_CERT_PATH are not set. HTTPS is not configured.
✅ Environment variables validated successfully

Signed-off-by: --global <idisepraise@gmail.com>
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

@praise-idise is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@praise-idise Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🔄 [MEDIUM] Server Starts Without Validating Critical Environment Variables

1 participant