How to apply environment variable overrides to a json config
- Step 1Paste the base config — Paste config.base.json as the first input. This is the default configuration with sensible values for local development.
- Step 2Paste the environment override — Paste config.production.json (or staging, testing) as the second input. Include only the keys that differ from base — the merge preserves all unoverridden base values.
- Step 3Review the resolved config — Verify the resolved config shows the expected values: production database URL from the override, development log level from the base, and all other base values unmodified.
- Step 4Use as the expected config in your startup tests — Copy the merged output as the expected value in a config resolution unit test. The test runs the application's config merge function and asserts the output matches the expected merged config.
Frequently asked questions
How do I implement environment config merging in Node.js?+
const base = require('./config.base.json'); const env = require(`./config.${process.env.NODE_ENV}.json`); const config = merge({}, base, env). Use lodash.merge for deep merging. Alternatively, use the convict library which handles environment variable injection and config schema validation together.
Should environment-specific configs contain secrets?+
No. Environment-specific JSON config files should contain non-secret overrides (log levels, service URLs, feature flags). Secrets (API keys, database passwords) should be injected from environment variables at runtime — never stored in committed JSON files. The merged config should include placeholder keys whose values are resolved from env vars at startup.
Are configuration values transmitted to JAD Apps?+
No. Merging runs entirely in your browser. Configuration values and override objects are never transmitted to JAD Apps servers.
Privacy first
Conversion runs locally in your browser. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.