Skip to content

Simplify the configuration handling code #168

@AlanRostem

Description

@AlanRostem

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:

  1. NewFromViper() *HostConfig
  2. NewFromCue(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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions