Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Cascading the configuration loader #647

Open
0x4007 opened this issue Aug 20, 2023 · 0 comments
Open

Cascading the configuration loader #647

0x4007 opened this issue Aug 20, 2023 · 0 comments

Comments

@0x4007
Copy link
Member

0x4007 commented Aug 20, 2023

I was doing a little refactoring, trying to clean up the configuration loading functions and I realized that we might be able to do something like this:

return { ...fallback, ...organization, ...repository }[key];

To dramatically simplify our configuration loading functions.

The benefit of this is that the built-in defaults fallback are first, then the organization configuration overwrites, and then finally repository configuration does the final overwrite.

This means that the repository configuration will dominate the rest, for example.

Is this implementation a bad idea?

Context: a6ef97a#diff-d9b0865f2e8f841410cd4faf3e1e4a1fb7cb0b545f583f6adaad5841d7eaa58dR52


We can do this using lodash function merge (example)

Originally posted by @whilefoo in #648 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant