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

Read All config from a resource folder #820

Open
codebyswaraj opened this issue Sep 8, 2020 · 2 comments
Open

Read All config from a resource folder #820

codebyswaraj opened this issue Sep 8, 2020 · 2 comments

Comments

@codebyswaraj
Copy link

codebyswaraj commented Sep 8, 2020

I have few files in a resource folder and I have a mapping class for the same. Now All I want is to load each file in different config class using pureconfig. Is there any way to load it via providing only resource folder name.

- src
    - main
        - resources
            - configs
                - conf1.json
                - conf2.json

I want something like this

ConfigSource.resources("configs")

and it should return

List<Conf>
@ruippeixotog
Copy link
Member

ruippeixotog commented Oct 9, 2020

I don't think there is. This seems to be a very specific use case, so this is likely not going to be added to PureConfig core. However, if you list all resources files by yourself (which should be fairly easy), you can load each of them using ConfigSource.resources and combine them as required.

@tg44
Copy link

tg44 commented Oct 28, 2020

It is not fairly easy to list resource files both in .jar and local dev.
I have a snippet which may help. The listing part is the problematic, if you know the name of the file(s) everything is much easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants