bbctl configuration values that can only be certain values should use enums
Configuration values that can only be a specific value should be converted to use custom types instead of generic values like string
.
For example:
// Log format: json, text
LogFormat string `mapstructure:"bbctl-log-format" json:"bbctl-log-format" yaml:"bbctl-log-format"`
can only be one of two values, so a custom type with constants should be created:
type LogFormat string
const (
Text LogFormat = "text"
JSON LogFormat = "json"
)
The global configuration can then be updated to:
// Log format: json, text
LogFormat LogFormat `mapstructure:"bbctl-log-format" json:"bbctl-log-format" yaml:"bbctl-log-format"`
These values are still functionally strings and can be worked with as such, but this way the compiler can assert that only valid values are set.
Acceptance Criteria
- Audit all configuration fields (top level and sub) and identify what needs to be updated
- Create types for all valid fields
- Sync with @nbazzeghin on big-bang&488 for anything that will be updated so he can return the correct types.