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

HOCON: impossible to override NUMERIC value from ENV or properties #1439

Closed
Dkhusainov opened this issue Apr 27, 2021 · 5 comments
Closed

HOCON: impossible to override NUMERIC value from ENV or properties #1439

Dkhusainov opened this issue Apr 27, 2021 · 5 comments
Labels

Comments

@Dkhusainov
Copy link

Describe the bug
Library does not correctly resolve NUMBER(probably BOOLEAN too) types when they're set via ENV or properties(since it's all strings)

To Reproduce

config.conf

my.config.value: ${?MY_CONFIG_VALUE}

MyConfig.kt

@Serializable
class MyConfig(
  val value: Long
)

env:
MY_CONFIG_VALUE=1

parsing exception:
SerializationException: env variables required to be a NUMBER

Expected behavior
Config is correctly parsed

Environment

  • Library version: [e.g. 1.1.0]
@sandwwraith sandwwraith added feature up for grabs A good issue for external contribution labels May 11, 2021
@sandwwraith
Copy link
Member

Original HOCON library supports that (https://github.com/lightbend/config#optional-system-or-env-variable-overrides), so I thought it should be available out of the box... Turns out it isn't

@ahmadshabib
Copy link

@sandwwraith Hey, is this still up for grabs? if yes any head up I need to know before starting?

@sandwwraith
Copy link
Member

@ahmadshabib Yeah. Just follow guide https://github.com/Kotlin/kotlinx.serialization/blob/master/CONTRIBUTING.md#submitting-prs , everything should be self-explanatory. I think this feature does not require a configuration flag or public API change, so no design space here.

@peterfigure
Copy link

any workarounds for this?

@tobiaslieber
Copy link
Contributor

Hi,
I took the freedom to implement a possible solution in #1795 .

@sandwwraith sandwwraith removed the up for grabs A good issue for external contribution label Dec 20, 2021
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

5 participants