-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
chore: Add config defaults #65
base: main
Are you sure you want to change the base?
Conversation
We have a lot of region_name repitition, this sets defaults that match our configuration so that we can just remove those lines from the configuration.yaml entirely. Also fixes test_lint failing.
libsentrykube/config.py
Outdated
root = str(conf["root"]) if conf is not None and "root" in conf else "k8s" | ||
|
||
cluster_def_root = ( | ||
str(conf["cluster_def_root"]) | ||
if conf is not None and "cluster_def_root" in conf | ||
else f"clusters/{region_name}" | ||
) | ||
|
||
cluster_name = ( | ||
str(conf.get("cluster_name")) | ||
if conf is not None and "cluster_name" in conf | ||
else None | ||
) | ||
|
||
materialized_manifests = ( | ||
str(conf["materialized_manifests"]) | ||
if conf is not None and "materialized_manifests" in conf | ||
else f"materialized_manifests/{region_name}" | ||
) | ||
|
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.
There are a 4 instances of checks of conf is not None here. Wonder if it would be better to do the conf is None check once and set the required fields in that scenario. Then the other scenarios don't need that check and the code would be easier to comprehend.
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.
Ya I was on the fence of the clarity of this vs setting it twice.
We have a lot of region_name repetition, this sets defaults that match our configuration so that we can just remove those lines from the configuration.yaml entirely. This will allow us to completely remove the
k8s
dictionary entirely from our config files.