-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: improve configuration parsing #24
Conversation
pkg/config/config.go
Outdated
|
||
var Config AppConfig | ||
|
||
func ReadConfig(f *pflag.FlagSet, configFile string) error { |
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.
ReadConfig
reads more like reading the configuration from file, but we are doing more a generating of the configuration in this case,
Therefore i would suggest renaming to:
func ReadConfig(f *pflag.FlagSet, configFile string) error { | |
func GenerateConfig(f *pflag.FlagSet, configFile string) error { |
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.
just one nit - #24 (comment)
but i will approve it anyway
Co-authored-by: bavarianbidi <mario.constanti@mercedes-benz.com>
README.md
Outdated
curl -L https://github.com/mercedes-benz/garm-operator/releases/download/${GARM_OPERATOR_VERSION}/garm-operator-all.yaml | envsubst | kubectl apply -f - | ||
``` | ||
|
||
The Full Configuration Parsing Documentation can be found in the [configuration parsing guide](./docs/config/configuration-parsing.md) |
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 Full Configuration Parsing Documentation can be found in the [configuration parsing guide](./docs/config/configuration-parsing.md) | |
The full configuration parsing documentation can be found in the [configuration parsing guide](./docs/config/configuration-parsing.md) |
docs/config/configuration-parsing.md
Outdated
|
||
# Configuration Parsing | ||
|
||
The Configuration Parsing for the Garm Operator is implemented with [koanf](https://github.com/knadh/koanf). |
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 Configuration Parsing for the Garm Operator is implemented with [koanf](https://github.com/knadh/koanf). | |
The configuration parsing for the Garm Operator is implemented with [koanf](https://github.com/knadh/koanf). |
docs/config/configuration-parsing.md
Outdated
|
||
The Configuration Parsing for the Garm Operator is implemented with [koanf](https://github.com/knadh/koanf). | ||
|
||
The Configuration can be defined with `ENVs`, `Flags` and `config file (yaml)`. |
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 Configuration can be defined with `ENVs`, `Flags` and `config file (yaml)`. | |
The configuration can be defined with `ENVs`, `Flags` and `config file (yaml)`. |
docs/config/configuration-parsing.md
Outdated
|
||
For the Garm Operator the following order is defined, which is to be considered in ascending order from lowest to highest priority: | ||
|
||
1. Defined Default Values ([see section Configuration Default Values](#configuration-default-values)) |
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.
1. Defined Default Values ([see section Configuration Default Values](#configuration-default-values)) | |
1. Defined default values ([see section configuration default values](#configuration-default-values)) |
docs/config/configuration-parsing.md
Outdated
--dry-run | ||
``` | ||
|
||
The `--config` flag can be set to specify the path to the `config file (yaml)` which contains the configuration ([see section Config File Strucutre](#config-file-structure)). |
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 `--config` flag can be set to specify the path to the `config file (yaml)` which contains the configuration ([see section Config File Strucutre](#config-file-structure)). | |
The `--config` flag can be set to specify the path to the `config file (yaml)` which contains the configuration ([see section config file structure](#config-file-structure)). |
docs/config/configuration-parsing.md
Outdated
|
||
The `--config` flag can be set to specify the path to the `config file (yaml)` which contains the configuration ([see section Config File Strucutre](#config-file-structure)). | ||
|
||
The `--dry-run` flag can be set to show the parsed configuration, without starting the Garm Operator. The Output can be similar to the following: |
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 `--dry-run` flag can be set to show the parsed configuration, without starting the Garm Operator. The Output can be similar to the following: | |
The `--dry-run` flag can be set to show the parsed configuration, without starting the Garm Operator. The output can be similar to the following: |
docs/config/configuration-parsing.md
Outdated
|
||
## Parsing Validation | ||
|
||
After the Configuration has been parsed by koanf and unmarshelled into a struct, the [validator](https://github.com/go-playground/validator) checks whether the generated struct is valid or not. |
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.
After the Configuration has been parsed by koanf and unmarshelled into a struct, the [validator](https://github.com/go-playground/validator) checks whether the generated struct is valid or not. | |
After the configuration has been parsed by koanf and unmarshalled into a struct, the [validator](https://github.com/go-playground/validator) checks whether the generated struct is valid or not. |
This PR ensures, that the configuration of the garm-operator can be done with
ENVs
,Flags
andConfig File (yaml)