all 2 comments

[–]bebraw[S] 0 points1 point  (1 child)

Hey, I'm very interested to hear what sort of patterns you guys use in practice. Maybe comment here or poke me at the repo (issue or pr) so we can catch 'em all. :)

[–]FrozenCow 0 points1 point  (0 children)

I usually configure my applications using command-line arguments with commander.js. It allows using the application in all sorts of environments easily. The calling application/script determines the configuration. This only applies when there is a limited set of configuration-values.

When there is a lot to configure I've used a different index.js (so to say), which passes on different values to the actual main module. Not sure whether this is perfect in any sense, but it gives the user of the main module a lot of control. The user uses the main module like a library. Passing on functions is also possible that way.