How does config.js hierarchy work with stages?


#1

Trying to better understand stage-specific config files.

For this example there are stages: dev, prod

Scenario

//config.js
module.exports = {
custom: {
a: ‘a1’,
b: ‘b1’
}
}

//config.dev.js
module.exports = {
custom: {
b: ‘b2’,
c: ‘c2’
}
}

//config.prod.js
module.exports = {
custom: {
c: ‘c3’
}
}

If my STAGE=dev will I have access to keys all keys with some overridden values?
a=‘a1’
b=‘b2’
c=‘c2’

If my STAGE=prod, will I have my values be below?
a=‘a1’
b=‘b2’
c=‘c3’

Basically trying to understandif config.js can have some default values that may or may not be overridden by a stage or if only the config for the stage is called.


#2

The stage-specific config (e.g. config.prod.js) overrides/merges into the default config (config.js).
Learn more here: https://www.jovo.tech/docs/config-js#staging

The above is correct!

I think it would be this:

a=‘a1’
b=‘b1’
c=‘c3’

The dev config isn’t added. Only the prod config is merged into the default with its c: 'c3'