-
Notifications
You must be signed in to change notification settings - Fork 332
Improvements to PolarisConfiguration #97
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
Conversation
polaris-core/src/main/java/io/polaris/core/PolarisConfigurationStore.java
Outdated
Show resolved
Hide resolved
flyrain
left a comment
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 overall. Some questions:
Do we consider reusing other libs like Apache Common Configuration, or Lombok(need Spring)? For exmaple, we don't have to write our own type casting, the former can convert data type as the following code shows.
Configuration config = configs.properties("config.properties");
// Convert to different data types
String appName = config.getString("app.name");
int port = config.getInt("app.port");
boolean isActive = config.getBoolean("app.active");
double timeout = config.getDouble("app.timeout");
Lombok is even simpler with less code. I know it has to combine with spring boot, but considering a lot of benefits it brings as well as great eco system around spring. It's worth to explore.
|
Looks good @flyrain, I think we should continue to think about this. For one thing, I want to make sure we have a way to surface these in the docs. I'd be open to adding a library here, but I thought it would be wise to incrementally improve this. wrt casting I believe our current setup is supposed to not require casting, but when you override DropWizard configs like this test does the value does not cast from String to Boolean correctly. I added the |
|
The actually most advanced config library I've seen is smallrye-config. |
Description
I've had a hard time working with PolarisConfiguration and ran into various casting issues during testing. Before we have too many configurations, let's impose some structure on these and make it easier to get values out of configs.
I've also unified the catalog-level and service-level configs here, and added a description for each config.
Type of change
Please delete options that are not relevant.
Checklist:
Please delete options that are not relevant.