-
Notifications
You must be signed in to change notification settings - Fork 67
Description
The current way the config is handled is very complex for handling both cli/viper and Cue, and difficult to maintain compatibility between them.
I suggest putting all possible config parameters in the HostConfig from https://github.com/relab/hotstuff/blob/master/internal/config/config.go
...and implement two constructor variants for this struct:
NewFromViper() *HostConfigNewFromCue(filepath string) *HostConfig
Variant 1 creates the struct using viper.Get()-like calls to supply the values to the struct. We use this variant when the --cue flag is empty.
Otherwise, when a Cue file is specified, variant 2 is used. This means the schema.cue file must support default values like the way Viper is set up now.
I believe this approach simplifies things a lot and the way configs are handled for both formats will be the same code and decoupled.