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

toml provider file discovery issue? #50

Closed
dtanner opened this issue Feb 9, 2020 · 3 comments
Closed

toml provider file discovery issue? #50

dtanner opened this issue Feb 9, 2020 · 3 comments
Labels

Comments

@dtanner
Copy link

dtanner commented Feb 9, 2020

Hi - first time using this (it's really nice BTW), and I think I found a minor issue.

using the auto-extension discovery feature, it looks like it's limited to json and properties file types currently. e.g. If I send a .toml file to this function:

fun loadConfig(configFile: File): AppConfig {
    return Config()
        .from.file(configFile)
        .toValue()
}

it fails with com.uchuhimo.konf.source.UnsupportedExtensionException: cannot detect supported extension for "test-config.toml", supported extensions: conf, json, properties, toml, xml, yml, yaml.
It looks like this is because of DefaultLoaders:137, where it calls

 fun of(extension: String): Provider? =
            extensionToProvider[extension]

whose implementation is this:

private val extensionToProvider = ConcurrentHashMap(mutableMapOf(
            "json" to JsonProvider,
            "properties" to PropertiesProvider
        ))

my sample loadConfig works fine if I use .from.toml.file(configFile).
See anything I'm doing wrong? It's not a big deal either way. Thanks.

@anelam
Copy link

anelam commented Apr 1, 2020

I have the same problem, using version 0.22.1.

@stale
Copy link

stale bot commented Jul 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.

@stale stale bot added the stale label Jul 1, 2020
@uchuhimo uchuhimo added 0.23.0 and removed stale labels Oct 8, 2020
@uchuhimo
Copy link
Owner

@dtanner @anelam I have released a new version v0.23.0 that fixes this bug. You can try it now. Any further feedback is welcome.

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

No branches or pull requests

3 participants