-
Notifications
You must be signed in to change notification settings - Fork 12
Feature/add config validation #15
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
base: master
Are you sure you want to change the base?
Feature/add config validation #15
Conversation
Co-authored-by: ceecko <[email protected]>
Co-authored-by: ceecko <[email protected]>
ceecko
left a comment
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.
I left a comment in the nested keys example where I think the validation fails.
One more thing I just realized, not really a request for a change, rather a general comment - how do we want to approach optional configuration?
Let's say we have a configuration such as enableSlack: bool.
If it's enabled, the slackAPIKey needs to be populated, otherwise it can be left empty.
The example config shows an example for the slackAPIKey (as expected) but it's not mandatory to be populated in the config if Slack is disabled. This way the validation reports the API key is missing, although it's not mandatory.
It's not clear to me what the best approach would be here. I just wanted to bring this up since there can be this type of configuration options.
|
One other topic - how do we want to approach checking configs which are based on a common config? |
|
I would get back to the original issue we had: if there's a example config, we must ensure all fields are present in config. That is covered and we can improve moving forward |
In config: {
"slackAPIKey": "xyz"
}In implementation: this.loadConf('some.coin', 'coin', { slackAPIKey: { required: true } })
// somewhere else:
if (this.ctx.conf.slackAPIKey) {
this.ctx.lib.slackClient.send();
}There's always more than one way to achieve things |
package-lock.jsonfrom.gitignore?Joior similar to avoid extra dependencies and our comparison is pretty simple hereREADME.md