node-config icon indicating copy to clipboard operation
node-config copied to clipboard

[BUG] Configuration files with different extensions and APP_INSTANCE not loaded in the right order

Open sgaestel opened this issue 3 years ago • 2 comments

Describe the bug I having config files with different extensions, and some defined using an APP_INSTANCE, the loading order is not the expected one.

Let's say I have following files:

development-instance.json
development-instance.yml
development.yml

They are currently loaded as:

development-instance.json
development.yml
development-instance.yml

Expected behavior From the documentation (and checking at the extensions loading order), I would expect files to be loaded in following order:

development.yml
development-instance.json
development-instance.yml

Please tell us about your environment:

  • node-config version: 1.31.0
  • node-version: 16.20.2

sgaestel avatar Nov 15 '23 16:11 sgaestel

You're right that the expected and documented behavior is to load in this order

development.yml
development-instance.json
development-instance.yml

It would be a bug if it loaded development-instance.json before development.yml.

Would you or a community member be willing to validate this bug by writing a failing test?

lorenwest avatar Nov 15 '23 18:11 lorenwest

Submitted a PR with both the test and the fix here

sgaestel avatar Nov 16 '23 09:11 sgaestel