3 ms·
Why not put it in code? You're program in strong typed lang, you write the config in that lang. You have a config function (analogous to the file) and a config
by cies 5y ago
Why not put it in code? You're program in strong typed lang, you write the config in that lang. You have a config function (analogous to the file) and a config "data" type (returned by the function, specified by the "configuree"). The function can only read env vars (keys, secrets, etc) and return the data structure layout by the app, strong typed enough you can prevent any side-effect easily by restricting the return type of the config function.
Your IDE can help you write only acceptable config files (functions) this way.
In case you do not want to recompile for conf file changes, many languages come with some kind of interpreter. You may even make it hot-reloadable for some properties.
You need more, you probably need a config service, which you can build in a type safe fashion as well.