[ https://issues.apache.org/jira/browse/KARAF-7608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17649309#comment-17649309 ]
ASF GitHub Bot commented on KARAF-7608: --------------------------------------- jbonofre merged PR #1698: URL: https://github.com/apache/karaf/pull/1698 > 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ß > Assignee: Jean-Baptiste Onofré > Priority: Major > > [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)