You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2022/12/19 12:43:00 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17649311#comment-17649311 ] 

ASF subversion and git services commented on KARAF-7608:
--------------------------------------------------------

Commit 47bd65b36c5328c73869ae25dfb575c01c7d1766 in karaf's branch refs/heads/main from Jean-Baptiste Onofré
[ https://gitbox.apache.org/repos/asf?p=karaf.git;h=47bd65b36c ]

Merge pull request #1698 from jbonofre/KARAF-7608

[KARAF-7608] Support factory configuration override with environment variable

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