#How are configuration files loaded? How are settings chosen/overwritten/merged?

1 messages · Page 1 of 1 (latest)

timid pewter
#

I'm observing so really strange behavior when I specify more than 1 config:

CMD ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.production.yaml", "--config", "app-config.docker.yaml"]

(note: NODE_ENV is set to production)

quiet stirrup
#

Config files are given priority based on the order they are provided. So priority will be in following order --> app-config.docker.yaml >>> app-config.production.yaml >>> app-config.yaml

#

So if any key is present in all the three files then, value of app-config.docker.yaml will be taken.

timid pewter
#

Thank Prateek - so it follows an override policy? Or merge-override-if-exist?

quiet stirrup
#

yes. it follows merge-override-if exist pattern.

silk patio
#

Exactly. That way you don't have to repeat yourself so much. You often have a "base" config with all of the universal truths, and then small slices of config that hold only the variations for each env