Skip to content
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

Refacto configuration #34

Merged
merged 7 commits into from
Jun 30, 2023
Merged

Refacto configuration #34

merged 7 commits into from
Jun 30, 2023

Conversation

kpetremann
Copy link
Owner

migrate to viper configuration

Without this separation, pretty logging cannot be set before knowing the
log level. Hence it ended up with json logs if there was an issue during
config read.
The goal is to be able to configure the exporter from both flags and
YAML config file.

Ultimately we will be able to load configuration from varenv too, which
is useful when using docker-compose.

Important note:

To avoid breaking change on the CLI, we keep golang flags.
We do not migrate to pflag like viper users usually do.

This is because golang flags authorize long name with one or two dashes:
-port 8080 or --port 8080

Pflag follows UNIX convention, so it does not authorize single dash for
long names. The benefit is that pflag supports shortname concatenation:
-a -b -c ==> -abc.
Makes more sense to move these as filters in the metrics configuration.
More structured main to respect one function = one role.
@kpetremann kpetremann force-pushed the refacto_configuration branch from 6ee7e34 to c29c864 Compare June 28, 2023 20:34
@kpetremann kpetremann merged commit 0b9ebc2 into main Jun 30, 2023
@kpetremann kpetremann deleted the refacto_configuration branch June 30, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant