Direct Answer
KrakenJS selects environment-specific settings through an environment object in kraken.json that is keyed to NODE_ENV. To keep builds repeatable across stages, commit a single kraken.json with explicit blocks for each target and set NODE_ENV in your build or deploy script. KrakenJS does not provide a documented mechanism to inject arbitrary external configuration profiles into the distribution pipeline beyond its built-in loading hierarchy; complex multi-profile scenarios usually require external tooling or custom middleware.
Confirmed Behavior vs. Version-Dependent Details
Confirmed: The framework loads configuration in a defined order—base defaults, then the environment block selected by NODE_ENV, followed by command-line arguments and process environment variables. This allows one source-of-truth file to drive different stages without manual edits.
Version-dependent: Recent KrakenJS releases formalized environment-block merging. Earlier versions may rely on manual require() patterns, so the exact installed version changes whether the environment key works as described. Verify before relying on it.
Steps for Repeatable Builds
- Add an
environment map to kraken.json:
{
"environment": {
"development": { "port": 3000 },
"production": { "port": 8080 }
}
}
- Set
NODE_ENV consistently in your pipeline:
NODE_ENV=production node index.js
- Log the resolved configuration at bootstrap and diff the merged settings across stages to confirm parity.
Limits on External Profile Injection
There is no built-in hook to swap in an external JSON profile during distribution. The supported path is NODE_ENV-driven block selection. If you need to layer secrets or stage-specific files that are not committed, use environment variables or a wrapper config loader rather than modifying kraken.json per target.
Missing Diagnostic Detail
The one missing detail that changes the recommendation is your installed kraken-js version. Run the following to confirm whether native environment-block merging is available:
node -e "require('kraken-js/package.json').version"
If the version predates formal merging, switch to explicit environment requires or a config library such as nconf. Also validate the final merged object after NODE_ENV is set, because overlapping keys can produce unexpected precedence.