SimpleConfigObject
which I have no idea how to unwrap. Also, the parser blows up on the resulting file. How do I just write out a config as a valid hocon file?
SimpleConfigObject(
etc. sounds like toString, not render
TEST_SYS_PROP
is an environment variable..
Hi, is there a recommended way to convert variables from lower case to upper and vice-versa on a HOCON configuration?
country="NL"
country_uppercase=${country/...??}
Config
and remember which fields are accessed. Then "at the end" diff that vs all the fields that exist in the file. Does anyone have any advice on another way to do this?
ConfigValue
base class, that modeled a retrieved value and also contained the path of the key used to look it up. Using reflections
, I could find all the instances of those, extract the keys, and then compare it against the keys in the parsed config to see if there were any params in the config file that were never used.
Hi, is there any way to declare a value that takes the value of the encompassing "node" e.g. if I have:
cars {
toyota {
model = "toyota"
colour = "green"
}
ford {
model = "ford"
colour = "white"
}
}
is there any way I can assign a variable for model's value, so that I don't have to repeat the values for toyota and ford?
Sorry, not sure I understand. I was aiming for something like:
cars {
toyota {
model = "$parent" // automatically set to "toyota"
colour = "green"
}
ford {
model = "$parent" // automatically set to "ford"
colour = "white"
}
}
I read the github page and don't think this kind of substitution exists, but thought I'd ask in case I'd missed something.
If you have:
cars {
toyota {
model = "$parent" // automatically set to "toyota"
colour = "green"
}
ford {
model = "$parent" // automatically set to "ford"
colour = "white"
}
}
then you could parse cars
as a ConfigObject
(i think it is) and get the keys within it (toyota
, ford
), then parse the objects associated with the keys
Quick question, is it possible to override entire maps with the usage of environment variables? i.e. lets say I have the following
{
test = {
a = apple
b = bob
}
test = ${?TEST}
}
Is it possible to do something like
env "TEST.a=another" in order to override the test.a
field
I don't think I understand how resolve works. I feel like this should work? but it doesn't :
val cfg1 =
ConfigFactory.parseString("path: ${'$'}{?java.io.tmpdir}")
val cfg2 = ConfigFactory.load(cfg1)
val thing = cfg2.getObject("path")
thing.keys.forEach {
println("--")
println("$it - ${thing[it]}")
}
outputs :separator - Quoted(":")
/tmp
?
Hi,
We are using light bend config to get the hocon configurations. We have multiple files with configurations for several entities. Parsing all these configuration files takes time in minutes. Consequently, the configuration load time is also high.
We are looking for opportunities to improve the configuration load time. As one possible strategy, we are looking into parsing the configurations once and serializing the constructed config object.
Are there any existing approaches to achieve this? Also, any other suggestions to improve the config load time are welcome. Thanks in advance!
Hi I'm trying to load a Map of String -> Config without loosing type information so that I can iterate the key values and configure the map like this:
clients {
CLIENTA = {
org = "foobar"
},
CLIENTB = {
org = "catdog"
}
}
However, Config.root()
yields a Iterable Map.Entry
with ConfigValue
as value.
So far I've tried to work with ConfigValue
but I'm unable to fetch the Config
interface for type-safe reading the org
value.
Things I've tried so far:
configValue.atPath(".").getString("org") // Exception
configValue.atPath("/").getString("org") // Exception
configValue.atPath("").getString("org") // Exception
configValue.atKey(".").getString("org") // Exception
I wish I could do configValue.toConfig
and obtain the Config
interface..
Ideas are welcome!