-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add config module #33
Add config module #33
Conversation
@dcadenas heres the way I usually set up a config module for my projects. I inlined an example of using the config, but usually I would have that in the same module as the object/actor that needs the config. Its a pretty minimal example, but I would also be happy to show you some more 'real' examples of how I've used it in one of our production monitors. |
The main benefit, is that all the configuration can be loaded and parsed at startup, so that you can fail fast, and code that depends on that config are able to be made infallible, since the fallible fetching and parsing the config was already done before its construction. It also helps to make all the config typesafe once you go to use it. |
I forgot to mention. This allows easily overlaying a default config, with an environment based file config thats dynamically loaded based on environment variable, then a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
No description provided.