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

Enhancement Request : Support for directory recursion and wildcards when defining config locations #1197

Open
omasseau opened this issue Jul 18, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@omasseau
Copy link

Hello,

It would be great to be able to support directory recursion and wildcards when defining additional config locations.

What I would like to be possible is to automatically scan all .properties files under a given directory found in the classpath/or under a filesystem path, as additional locations for configuration properties files.
ex:
smallrye.config.locations=tenants/ (with tenants directory being in /resources/ of my project).

Currently we have to expicitely define the path of each .properties file under the directory :
smallrye.config.locations=tenants/fr/authentication.properties,tenants/fr/datasources.properties,tenants/lu/authentication.properties,tenants/lu/datasources.properties

It works but can be problematic when you may later have a lot of additional tenants.

What I would like to be is be able to define directories for each tenant of my application, each directory containing the properties associated to this tenant.
Example :

image

Being able to use wildcards in the path would be also great
ex :
smallrye.config.locations=tenants/*/*.properties

@omasseau omasseau changed the title Support for directory recursion and wildcards when defining config locations Enhancement Request : Support for directory recursion and wildcards when defining config locations Jul 18, 2024
@dmlloyd
Copy link
Contributor

dmlloyd commented Jul 22, 2024

Do you have a proposal about conflict resolution? Perhaps file iteration order would be significant, with later files overriding earlier files?

@omasseau
Copy link
Author

Do you have a proposal about conflict resolution? Perhaps file iteration order would be significant, with later files overriding earlier files?

In my case the properties defined in the files will always have different names.
But maybe we could have a property to specify the priority to apply between conflicting files ?

For example:

smallrye.config.locations.conflicts-resolution=PRIORITY_TO_DEEPER_LEVEL_FILES | PRIORITY_TO_HIGHER_LEVEL_FILES | PRIORITY_BASED_ON_ITERATION_ORDER | ALWAYS_FAIL

ALWAYS_FAIL being the default -> If two files have the same property defined, an error is raised.

@radcortez
Copy link
Member

ALWAYS_FAIL being the default -> If two files have the same property defined, an error is raised.

Right now, there is no restriction in defining the same property name in different files. In fact, this is how you can override configuration values. I think we shouldn't introduce something that behaves completely different.

@dmlloyd
Copy link
Contributor

dmlloyd commented Jul 22, 2024

In addition, there's a point you get to when you have meta-configuration for your configuration where having all the extra knobs and dials impacts usability by causing subtle problems that are hard to diagnose and debug. We generally want to have a single fixed set of rules whenever possible, so that questions have one answer and a given solution always works.

@radcortez radcortez added the enhancement New feature or request label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants