I thought it was weird that some software/libs/frameworks take executable code as config, but I recently read a blog talking about DSLs and config files with conditionals and statements.
It talked about how certain programs provide a DSL in their yaml configs (obviously in-house for each program). These DSLs are not portable because every system rolls their own.
Article here, https://blog.earthly.dev/intercal-yaml-and-other-horrible-programming-languages/
For example, Webpack can take config as an executable javascript file. I always thought that was weird (not bad), but I think I much prefer it to a DSL embedded in yaml or JSON.
I really like the config flow as
function genConfig(config) {
if (blah)
config.provideX()
config.sysEnabled = true
// etc...
}
where the function genConfig
is called by the program at startup. It's readable** and provides all the power of the programming language.