Add ability to pass configuration directly to node.app()?
Came across this on another project in relation to middleware. Certain middleware config will need access to JavaScript in order to work (e.g., defining custom rules for a cors config). Would be good if a new config option can be passed to node.app() which mimics the behavior of the config block in the settings.env.json file.
Need to think a bit on this to avoid confusion. Do we want to allow all configuration to be passed this way or just specific configuration? Can we get away with introducing a .js version of settings files to avoid this altogether (and build them like any other file)? Need to be mindful of backwards compatibility with .json files.
I think the answer here is specific config, like middleware. If a field that's not supported is defined, warn in the logs. For example:
joystick.app({
config: {
databases: [], // <-- This would trigger a warning.
middleware: {}, // <-- This would not.
},
})
This way we can configure things like middleware that could benefit from access to JS (vs. the existing JSON limitation).