You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jean-Baptiste Onofré (Jira)" <ji...@apache.org> on 2022/12/19 12:44:00 UTC

[jira] [Updated] (KARAF-7608) Override config option by environment variable not possible

     [ https://issues.apache.org/jira/browse/KARAF-7608?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Baptiste Onofré updated KARAF-7608:
----------------------------------------
    Target Version/s: 4.4.3, 4.3.9  (was: 4.4.3)

> 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)