Karaf Configuration: Environment variable mapping for properties containing minus sign

21 Views Asked by At

I have a Karaf configuration file where property names contain a minus sign.

my.file.cfg

my-group.my-property=42
myGroup.myOtherProperty=42

When I try to redefine this property via env variable MY_FILE_MY_GROUP_MY_PROPERTY or MY_FILE_MYGROUP_MYPROPERTY, Karaf ignores the environment variable.

How can I override Karaf property values which have minus signs in their key?

Note that MY_FILE_MYGROUP_MYOTHERPROPERTY works like a charm. So the minus signs are the challenge.

1

There are 1 best solutions below

0
dschulten On

Conclusion: it is impossible to use environment variables in order to override properties containing minus signs in Karaf cfg property names. Dots become underscores, everything else gets converted to uppercase. There is no mapping for minus signs in environment var names.

Also note that the property name must be prefixed with the name of the cfg file followed by underscore, where the file name may contain dots which get converted to underscores, too.

Source: https://karaf.apache.org/manual/latest/#_environment_variables_system_properties