{"id":"69167a0fadcd0bfee0252023","title":"2025 10 26 Issue 68 Env Variables","path":"how-to/committee/release-notes/2025-10-26-issue-68-env-variables","contentMarkdown":"# 26th October 2025 — Environment Variable Centralization and Migration Status [#68](https://github.com/nbarrett/ngx-ramblers/issues/68)\n## [build 333](https://github.com/nbarrett/ngx-ramblers/actions/runs/18823789797) — [#68](https://github.com/nbarrett/ngx-ramblers/issues/68) — [commit b93c69b](https://github.com/nbarrett/ngx-ramblers/commit/b93c69b)\n\nEnvironment configuration refactored with type-safe enum, migration system enhancements for database-driven status, and improved health monitoring.\n\n**Where to Find It**\n\n- **Entire Application**: Environment variable access now type-safe via enum\n- **System Status**: Health checks reflect migration state accurately\n- **Migration UI**: Consistent filename display across all environments\n\n**Benefits**\n\n- **Type Safety**: Environment variables use TypeScript enums with IDE autocomplete\n- **Deployment Reliability**: Server starts even when NODE_ENV not explicitly set (defaults to \"development\")\n- **Consistent Migration Display**: Database-driven status shows same files locally and in production\n- **Improved Monitoring**: Health checks accurately reflect migration state for automated alerts\n- **Cleaner Logs**: TypeScript declaration files no longer incorrectly identified as migrations\n- **Better Maintainability**: Centralized environment variable definitions\n- **Database-Driven Status**: Migration state purely from database, independent of environment\n- **Improved File Detection**: Filters exclude .d.ts and .d.js files, normalize .ts/.js handling\n\n**Technical Details**\n\nEnvironment Variable Refactoring:\n- Create Environment enum with all application environment variables\n- Replace all process.env string literal access with enum references\n- Add envConfig.isProduction() helper for NODE_ENV checks\n- Use envConfig.booleanValue() for boolean environment variable parsing\n- Move booleanOf() to shared string-utils for frontend/backend reuse\n- Use existing envConfig wrappers (env, mongo.uri) where available\n- Change RUN_MIGRATIONS_ON_STARTUP to SKIP_MIGRATIONS_ON_STARTUP (migrations now run by default)\n- Default NODE_ENV to \"development\" when not set\n\nMigration Status Improvements:\n- Fix health endpoint to return 503 when migrations pending\n- Update system status check to include pending migrations in health calculation\n- Fix site-maintenance component to show correct operational status\n- Display Status inline with Applied/Pending/Failed counts\n- Add consistent vertical borders to migration table\n- Replace console.log with logger in paste-detection service\n\nMigration Filename Normalization:\n- Normalize all migration filenames to .js extension for consistency\n- Scan for both .ts and .js files on disk but display as .js in UI\n- Check database for both .ts and .js versions when determining status\n- Ensure migration status is purely database-driven, not environment-dependent\n- Update simulated migration filenames to use .js extension","contentHtml":"<h1>26th October 2025 — Environment Variable Centralization and Migration Status <a href=\"https://github.com/nbarrett/ngx-ramblers/issues/68\">#68</a></h1>\n<h2><a href=\"https://github.com/nbarrett/ngx-ramblers/actions/runs/18823789797\">build 333</a> — <a href=\"https://github.com/nbarrett/ngx-ramblers/issues/68\">#68</a> — <a href=\"https://github.com/nbarrett/ngx-ramblers/commit/b93c69b\">commit b93c69b</a></h2>\n<p>Environment configuration refactored with type-safe enum, migration system enhancements for database-driven status, and improved health monitoring.</p>\n<p><strong>Where to Find It</strong></p>\n<ul>\n<li><strong>Entire Application</strong>: Environment variable access now type-safe via enum</li>\n<li><strong>System Status</strong>: Health checks reflect migration state accurately</li>\n<li><strong>Migration UI</strong>: Consistent filename display across all environments</li>\n</ul>\n<p><strong>Benefits</strong></p>\n<ul>\n<li><strong>Type Safety</strong>: Environment variables use TypeScript enums with IDE autocomplete</li>\n<li><strong>Deployment Reliability</strong>: Server starts even when NODE_ENV not explicitly set (defaults to &quot;development&quot;)</li>\n<li><strong>Consistent Migration Display</strong>: Database-driven status shows same files locally and in production</li>\n<li><strong>Improved Monitoring</strong>: Health checks accurately reflect migration state for automated alerts</li>\n<li><strong>Cleaner Logs</strong>: TypeScript declaration files no longer incorrectly identified as migrations</li>\n<li><strong>Better Maintainability</strong>: Centralized environment variable definitions</li>\n<li><strong>Database-Driven Status</strong>: Migration state purely from database, independent of environment</li>\n<li><strong>Improved File Detection</strong>: Filters exclude .d.ts and .d.js files, normalize .ts/.js handling</li>\n</ul>\n<p><strong>Technical Details</strong></p>\n<p>Environment Variable Refactoring:</p>\n<ul>\n<li>Create Environment enum with all application environment variables</li>\n<li>Replace all process.env string literal access with enum references</li>\n<li>Add envConfig.isProduction() helper for NODE_ENV checks</li>\n<li>Use envConfig.booleanValue() for boolean environment variable parsing</li>\n<li>Move booleanOf() to shared string-utils for frontend/backend reuse</li>\n<li>Use existing envConfig wrappers (env, mongo.uri) where available</li>\n<li>Change RUN_MIGRATIONS_ON_STARTUP to SKIP_MIGRATIONS_ON_STARTUP (migrations now run by default)</li>\n<li>Default NODE_ENV to &quot;development&quot; when not set</li>\n</ul>\n<p>Migration Status Improvements:</p>\n<ul>\n<li>Fix health endpoint to return 503 when migrations pending</li>\n<li>Update system status check to include pending migrations in health calculation</li>\n<li>Fix site-maintenance component to show correct operational status</li>\n<li>Display Status inline with Applied/Pending/Failed counts</li>\n<li>Add consistent vertical borders to migration table</li>\n<li>Replace console.log with logger in paste-detection service</li>\n</ul>\n<p>Migration Filename Normalization:</p>\n<ul>\n<li>Normalize all migration filenames to .js extension for consistency</li>\n<li>Scan for both .ts and .js files on disk but display as .js in UI</li>\n<li>Check database for both .ts and .js versions when determining status</li>\n<li>Ensure migration status is purely database-driven, not environment-dependent</li>\n<li>Update simulated migration filenames to use .js extension</li>\n</ul>\n"}