utybo / Tegral

🟣 A Kotlin framework for web applications, cool libraries that go along with it!
https://tegral.zoroark.guru
Apache License 2.0
37 stars 3 forks source link

Tegral missing from config even if there are no required sections #48

Closed utybo closed 1 year ago

utybo commented 2 years ago

e.g.

data class MyConfig(
        override val tegral: TegralConfig,
        val hello: String,
        val foo: FooConfig
) : RootConfig

data class FooConfig(val bar: String)

val app = tegral(enableDefaults = false) {
    useConfiguration<MyConfig>()

    useConfiguration {
        addSource(TomlPropertySource("""
            hello = "Hello!"
            [foo]
            bar = "Bar!"
        """.trimIndent()))
    }

    put(::FoobarService)
}
Error loading config because:

    - Could not instantiate 'guru.zoroark.tegral.web.appdsl.Issue39Repro.MyConfig' because:

        - 'tegral': Missing from config
com.sksamuel.hoplite.ConfigException: Error loading config because:

    - Could not instantiate 'guru.zoroark.tegral.web.appdsl.Issue39Repro.MyConfig' because:

        - 'tegral': Missing from config
utybo commented 1 year ago

Seems that this was fixed by #75, will add tests in a later PR