Read empty string ENV var to HOCON conf but getting weird double quoted empty string

74 views Asked by At

I have tried to read empty string env var to HOCON conf but getting weird """" when I read it. Tried to read the official doc and tried different variations such as not setting env var at all but could not come to solution.

I am setting env var in .env file as

export SUPPORTED_VALUES=""

and HOCON configuration as given below

{
  feature:
    supported-values: ${?SUPPORTED_VALUES}
}

when I read this from Ktor HOCON parser, it reads as """" instead of "". I tried by giving no value to env var but then it is read as "null"

    private val supportedValues = appConfig.property("feature.supported-values").getString()
1

There are 1 answers

2
Aleksei Tirman On

The problem is that the environment variable contains the literal value "" ( you can check it out by calling System.getenv()["SUPPORTED_VALUES"]). To solve your problem leave the value empty:

export SUPPORTED_VALUES=