-
Notifications
You must be signed in to change notification settings - Fork 107
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
Config rework #5070
Config rework #5070
Conversation
475be30
to
2b21812
Compare
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.
Instead of using a global config, can we pass it explicitly?
Hmm, that seems like a lot of extra work. I'll first finish the current design and then we can discuss changing it. A lot of modules need access to config options outside of their module, so we'd have to pass the entire global config struct to all modules anyway. And currently, only a few modules have some kind of init function where we could pass the config in explicitly, so all the others would have to be refactored to include something like that. I think the current global struct design is cleaner (load once, use anywhere). |
1ce113b
to
392f78b
Compare
Idea: In order to still support "re-usable" config files (after the removal of cmdline flags) it would be great to support some variable substitution before the config file gets parsed. Could be as trivial as replacing e.g. |
I don't think that the |
392f78b
to
98ec45b
Compare
I think being able to set/override config values via environment variables should be possible, unless there is some hard reasoning not to support it. One option would be using something like koanf (we use it in https://github.com/oasisprotocol/emerald-web3-gateway). It makes it really easy to use a Or what @gw0 posted below. |
It does not, but setting env variables is convenient and adding support (https://github.com/a8m/envsubst) is as simple as: import "github.com/a8m/envsubst"
data, err := envsubst.ReadFile("config.yaml")
err = yaml.Unmarshal(data, ...) |
Alright, I'll add that once I'm done with the test runner :) EDIT: I like the |
1b17bf2
to
a192b42
Compare
aea2010
to
2fbba78
Compare
77ade19
to
adfd9c8
Compare
e2041b8
to
ca60401
Compare
ca60401
to
890fd4b
Compare
w.storedDeregister = storedDeregister | ||
|
||
if flags.ConsensusValidator() { | ||
if config.GlobalConfig.Consensus.Validator { |
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.
This should also work if you set the global mode to validator?
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.
The previous code only checked the flag:
https://github.com/oasisprotocol/oasis-core/blob/master/go/oasis-node/cmd/common/flags/flags.go#L75-L77
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.
Yeah this was wrong, we should make sure that if you set the global mode to validator your node will actually become a validator :-)
SupplementarySanity SupplementarySanityConfig `yaml:"supplementary_sanity,omitempty"` | ||
|
||
// Enable tendermint debug logs (very verbose). | ||
LogDebug bool `yaml:"log_debug,omitempty"` |
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.
Should this go under the debug options?
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.
Hmm, it kind of makes sense to leave it here because it only sets the Tendermint log level to debug and isn't some unsupported debug flag.
890fd4b
to
14c29bb
Compare
Use a config file instead of command-line options.
14c29bb
to
2a132b3
Compare
This is still in heavy WIP.