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

Refactor: Config and CLI #63

Merged
merged 31 commits into from
Jan 12, 2024
Merged

Refactor: Config and CLI #63

merged 31 commits into from
Jan 12, 2024

Conversation

niklastreml
Copy link
Collaborator

@niklastreml niklastreml commented Jan 10, 2024

Motivation

The current configuration structure is disorderly, with most options using non-nested, lengthy names. This pull request addresses this issue by reorganizing the configuration layout to utilize nesting, as illustrated below:

Before:

fooBarBaz:
fooBarQux:

After:

foo:
    bar:
        baz:
        qux:

This restructuring enhances the clarity and maintainability of the configuration setup.

Adding a parameter to both the configuration and the Command Line Interface (CLI) currently requires changes in three different locations in the codebase. This pull request aims to streamline and simplify this process.

Closes #47

Changes

Removed flagmapping struct and replaced it with a simple abstraction over Viper and Cobra. The acbstraction provides a unified approach for registering and binding configuration keys to CLI parameters. This abstraction follows a builder pattern, enhancing code structure and maintainability. Also updated helm chart, to reflect the changes to the config.

For additional details, refer to the commit history.

Tests done

  • Updated unit tests to work with the new config

@lvlcn-t lvlcn-t added the refactoring Refactoring of existing code label Jan 11, 2024
Copy link
Member

@y-eight y-eight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look at the README as well in the end. Docu needs to be changed.
As soon as the auto generation is implemented we might rm the manually written docu.

cmd/flag.go Outdated Show resolved Hide resolved
cmd/flag.go Show resolved Hide resolved
cmd/flag.go Outdated Show resolved Hide resolved
chart/values.yaml Outdated Show resolved Hide resolved
pkg/config/config.go Show resolved Hide resolved
pkg/config/config.go Show resolved Hide resolved
pkg/config/config.go Show resolved Hide resolved
pkg/config/config.go Show resolved Hide resolved
pkg/config/validate.go Outdated Show resolved Hide resolved
pkg/config/config_test.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
pkg/checks/checks.go Outdated Show resolved Hide resolved
@puffitos
Copy link
Collaborator

Everything LGTM @niklastreml. I've removed the target manager as well in a separate PR so we can finish this one once and for all. :)

@niklastreml
Copy link
Collaborator Author

Sounds good 👍 @puffitos

Copy link
Collaborator

@lvlcn-t lvlcn-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 but wait with merging until #68 is merged into this branch

lvlcn-t and others added 3 commits January 11, 2024 20:27
- chore: remove unused file
- chore: latency receiver typo
- chore: grammar in root.go
- chore: uneeded or removed in charts
- chore: identation in chart fixed

Signed-off-by: Bruno Bressi <[email protected]>
cmd/run.go Outdated Show resolved Hide resolved
@puffitos puffitos added this to the 0.3.0 milestone Jan 12, 2024
@niklastreml niklastreml requested a review from y-eight January 12, 2024 13:32
Copy link
Member

@y-eight y-eight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx! LGTM

@niklastreml niklastreml merged commit 30fa7ea into main Jan 12, 2024
9 checks passed
@lvlcn-t lvlcn-t deleted the refactor/config-and-cli branch January 12, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Refactoring of existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Configuration handling is getting too complicated
4 participants