Oliver Fürniß created KARAF-7608:
------------------------------------

             Summary: Override config option by environment variable not 
possible
                 Key: KARAF-7608
                 URL: https://issues.apache.org/jira/browse/KARAF-7608
             Project: Karaf
          Issue Type: Bug
          Components: karaf
    Affects Versions: 4.4.2
            Reporter: Oliver Fürniß


[Related 
Documentation|https://karaf.apache.org/manual/latest/#_environment_variables_system_properties]

 

It works for most config options, but not for all. ;-)


Example config : {{[karaf]/etc/org.apache.felix.fileinstall-deploy.cfg}}
Option to override : {{felix.fileinstall.dir}}
Pid (config-list) : {{org.apache.felix.fileinstall~deploy}}

Problem is the '-' in the filename which gets converted to a '~' in the config 
Pid.

 

Karaf 4.4.2 code (ClientConfig.java & KarafConfigurationPlugin.java):

 
{code:java}
...
String env = (pid + "." + key).toUpperCase().replaceAll("\\.", "_");
...
{code}
When
pid = {{org.apache.felix.fileinstall~deploy}}
key = {{felix.fileinstall.dir}}

it results in
env = {{ORG_APACHE_FELIX_FILEINSTALL~DEPLOY_FELIX_FILEINSTALL_DIR}}

But most shells only support a-z, A-Z, 0-9 and _ for variable names.

And this fails due to the '~' character in the variable name
{code:java}
export 
ORG_APACHE_FELIX_FILEINSTALL~DEPLOY_FELIX_FILEINSTALL_DIR=/home/of/karaf_deploy_folder
 
{code}

Solution
Maybe replace all special characters to "_" and not just the dots?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to