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

Support wildcard configtree imports #22958

Closed
philwebb opened this issue Aug 14, 2020 · 2 comments
Closed

Support wildcard configtree imports #22958

philwebb opened this issue Aug 14, 2020 · 2 comments
Assignees
Labels
theme: config-data Issues related to the configuration theme type: enhancement A general enhancement
Milestone

Comments

@philwebb
Copy link
Member

Currently our configtree:/... import support will create a flattened structure by replacing / with .. For example, configtree:/etc/config for the following:

etc/
  config/
    db/
       password
    mq/
       password

Would add a db.password and mq.password properties.

This works well to prevent name clashes, but might be a problem if a user prefer to only use the filenames as properties. For example:

etc/
  config/
    mydbservice/
       spring.datasource.password
    mymqservice/
       spring.mq.password

We should look at options that will help with the second case.

@philwebb
Copy link
Member Author

It strikes me that this is quite similar to the wildcard support that we already have for spring.config.location. Perhaps rather than adding an option to ConfigTreePropertySource we should instead add wildcard support so that multiple folders can be added quickly.

I.e., given

etc/
  config/
    mydbservice/
       spring.datasource.password
    mymqservice/
       spring.mq.password

You could so spring.config.import=configtree:/etc/config/* and get two property sources. One for mydbservice containing spring.datasource.password and one for mymqservice containing spring.mq.password.

@philwebb philwebb added the type: enhancement A general enhancement label Aug 14, 2020
@philwebb philwebb added this to the 2.4.x milestone Aug 14, 2020
@philwebb philwebb self-assigned this Aug 14, 2020
@mbhave
Copy link
Contributor

mbhave commented Aug 14, 2020

Adding the restrictions we have in place for the wildcard support so that we can consider the same ones for the config tree.

  1. The location cannot contain multiple wildcards.
  2. The wildcard must be at the end of the path.
  3. Locations with wildcard directories are restricted to one-level deep.
  4. Locations with wildcard directories are sorted alphabetically.

@philwebb philwebb added the theme: config-data Issues related to the configuration theme label Sep 8, 2020
@philwebb philwebb changed the title Consider "leaf only" configtree imports Support wildcard configtree imports Oct 27, 2020
@philwebb philwebb modified the milestones: 2.4.x, 2.4.0-RC1 Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: config-data Issues related to the configuration theme type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants