-
Notifications
You must be signed in to change notification settings - Fork 727
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: Rewrite config parser to respect the order #4971
Conversation
Signed-off-by: Xuanwo <github@xuanwo.io>
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Thanks for the contribution! Please review the labels and make any necessary changes. |
I prefer load order like:
to treat environment variable as first-class citizen and respect the configuration from configfile, and it would also cause painful breaking change if config from configfile could overlap settings from environment variables |
Yep, this proposal does implement this order, next layer will overwrite the same value for the current layer. That means we will take env first, and |
Signed-off-by: Xuanwo <github@xuanwo.io>
envy is not suitable for databend as it can't deserialize value in nested structs. I build a new lib serde-env to fix it. Now, our PR is buildable. I'm going to move to the next step: make PR ready for review 🚀 |
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
I added a test for override: https://github.com/datafuselabs/databend/pull/4971/files#diff-a8af230cc9f832a19df365f4ddd5cf49cc3bd752705c27445008c928d7f2041dR193-R295 @ZhiHanZ Please help check whether this behavior is expected. |
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
/LGTM Tests should be fixed |
Signed-off-by: Xuanwo <github@xuanwo.io>
I guess we can consider a versioned config approach like: https://github.com/k3d-io/k3d/tree/main/pkg/config on introducing incompatible config changes, we can bounce up the config version with a migration logic, like https://github.com/flaneur2020/k3d/blob/412950bd84bcee0050c42515ef19356689152328/pkg/config/v1alpha3/migrations.go#L41 thus the older configs can keep compatible until the annual deprecation cycle, allowing users to migrate the configs after reading our deprecation news but before the actual api got break. |
I will add a version id first in this PR. Tracked at #5022 |
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
|
ping @BohuTANG @flaneur2020 for another approve. |
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.
lgtm
Signed-off-by: Xuanwo github@xuanwo.io
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
Summary
This PR will fix #4362
To make our config parsed in a more understandable way, I built the following two libs:
Now, our config is parsed in the following ways:
All of them are bridged by
serde-bridge
.With this PR, we will:
env-helper!
as we are loading by envyOur config will be more consistent and extensible.
Breaking Changes
args naming
access-key-id
tostorage-s3-access-key-id
region
tostorage-s3-region
load_from_args
,load_from_env
,load_from_file
fromConfig
All storage service-related args will be prefixed by
storage-<service>-
instead.env naming
S3_STORAGE_ACCESS_KEY_ID
toSTORAGE_S3_ACCESS_KEY_ID
env
will map to an arg directly.Preview
Current Status
PR is ready for review now!
Works are listed here
serde-bridge
,serfig
andserde-env
.Changelog
Related Issues
Fixes #4362