Can not parse environment variable
rts-gordon opened this issue · comments
Gordon commented
Hi there,
There are some environment variable defined like this:
[app]
env = "dev"
env.prefix = "TMT_"
the parse code:
ENV = koanf.New(".")
if err := ENV.Load(file.Provider(configFile), toml.Parser()); err != nil {
log.Fatalf("error loading config file: %v", err)
}
This will occurs error:
error loading config file: (8, 1): Unknown table type for path: app.env
But if the variable change like this, the parse will pass.
[app]
env.value = "dev"
env.prefix = "TMT_"
My question is: why the 'env' and 'env.prefix' confict? they are two different variables.
Thank you.
Kailash Nadh commented
Hi. That's invalid TOML. You can paste the snippet and validate it here.
Can't redefine existing key at row 3, col 20, pos 38: 2: env = "dev" 3> env.prefix = "TMT_" ^