You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by Steven Huypens <st...@gmail.com> on 2021/07/16 09:46:49 UTC

KARAF-4609 Be able to override ConfigAdmin properties with System/JVM properties

Hi all,

After upgrading to Karaf 4.3.2 the config file
org.apache.karaf.management.cfg seems to have changed unexpectedly. For
example

*rmiRegistryPort = ${env:ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYPORT:-1099}*

has been changed into

*rmiRegistryPort = 1099*

Is this intentional ? From https://issues.apache.org/jira/browse/KARAF-4609
I understand the environment variables should be included in 4.3 as well ?

Kind regards,
Steven Huypens

Re: KARAF-4609 Be able to override ConfigAdmin properties with System/JVM properties

Posted by Steven Huypens <st...@gmail.com>.
Hi JB,

Thanks, It's completely clear now.

Steven

On Mon, Jul 19, 2021 at 7:47 AM Jean-Baptiste Onofre <jb...@nanthrax.net>
wrote:

> Hi,
>
> Yes it’s normal, the config file can contain whatever you want.
>
> When you use implicit env variable, the config property is override at
> runtime.
>
> So, if you have etc/my.config.cfg containing:
>
> foo=bar
>
> Without any env variable, foo value will be bar.
>
> If you set export MY_CONFIG_FOO=other, then foo value will be other, but
> the config file itself still contain bar.
>
> Regards
> JB
>
> > Le 19 juil. 2021 à 07:24, Steven Huypens <st...@gmail.com> a
> écrit :
> >
> > Hi JB,
> >
> > From your answer I understand that Karaf will actually edit my
> config-file,
> > but we don't see this. The application behaviour is as expected, but the
> > config-file still contains the default values (as does ConfigAdmin),
> which
> > might be confusing.
> >
> > Is that how it is supposed to work, or should I have a closer to look at
> it?
> >
> > Kind regards,
> > Steven
> >
> > On Fri, Jul 16, 2021 at 4:41 PM Steven Huypens <steven.huypens@gmail.com
> >
> > wrote:
> >
> >>
> >> Thanks, we got it working now !
> >>
> >> Steven
> >>
> >> On Fri, Jul 16, 2021 at 1:30 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
> >> wrote:
> >>
> >>> Hi,
> >>>
> >>> yes, it's normal: the env variable support is now "implicit".
> >>>
> >>> You can still use ${env:*} syntax (it's the explicit form), or just the
> >>> corresponding env variable is enough (implicit).
> >>>
> >>> Basically, if you do:
> >>>
> >>> export COM_MY_PID_FOO=bar
> >>>
> >>> Karaf will set property foo to bar in etc/com.my.pid.cfg configuratuion
> >>> file (aka com.my.pid configuration).
> >>>
> >>> You can find some details about this here:
> >>>
> >>>
> https://nanthrax.blogspot.com/2020/11/what-new-in-apache-karaf-430_9.html
> >>>
> >>>
> >>>
> http://karaf.apache.org/manual/latest/#_environment_variables_system_properties
> >>>
> >>> Regards
> >>> JB
> >>>
> >>> On 7/16/21 11:46 AM, Steven Huypens wrote:
> >>>> Hi all,
> >>>>
> >>>> After upgrading to Karaf 4.3.2 the config file
> >>>> org.apache.karaf.management.cfg seems to have changed unexpectedly.
> For
> >>>> example
> >>>>
> >>>> *rmiRegistryPort =
> >>> ${env:ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYPORT:-1099}*
> >>>>
> >>>> has been changed into
> >>>>
> >>>> *rmiRegistryPort = 1099*
> >>>>
> >>>> Is this intentional ? From
> >>> https://issues.apache.org/jira/browse/KARAF-4609
> >>>> I understand the environment variables should be included in 4.3 as
> >>> well ?
> >>>>
> >>>> Kind regards,
> >>>> Steven Huypens
> >>>>
> >>>
> >>> --
> >>> Jean-Baptiste Onofré
> >>> jbonofre@apache.org
> >>> http://blog.nanthrax.net
> >>> Talend - http://www.talend.com
> >>>
> >>
>
>

Re: KARAF-4609 Be able to override ConfigAdmin properties with System/JVM properties

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi,

Yes it’s normal, the config file can contain whatever you want.

When you use implicit env variable, the config property is override at runtime.

So, if you have etc/my.config.cfg containing:

foo=bar

Without any env variable, foo value will be bar.

If you set export MY_CONFIG_FOO=other, then foo value will be other, but the config file itself still contain bar.

Regards
JB

> Le 19 juil. 2021 à 07:24, Steven Huypens <st...@gmail.com> a écrit :
> 
> Hi JB,
> 
> From your answer I understand that Karaf will actually edit my config-file,
> but we don't see this. The application behaviour is as expected, but the
> config-file still contains the default values (as does ConfigAdmin), which
> might be confusing.
> 
> Is that how it is supposed to work, or should I have a closer to look at it?
> 
> Kind regards,
> Steven
> 
> On Fri, Jul 16, 2021 at 4:41 PM Steven Huypens <st...@gmail.com>
> wrote:
> 
>> 
>> Thanks, we got it working now !
>> 
>> Steven
>> 
>> On Fri, Jul 16, 2021 at 1:30 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
>> wrote:
>> 
>>> Hi,
>>> 
>>> yes, it's normal: the env variable support is now "implicit".
>>> 
>>> You can still use ${env:*} syntax (it's the explicit form), or just the
>>> corresponding env variable is enough (implicit).
>>> 
>>> Basically, if you do:
>>> 
>>> export COM_MY_PID_FOO=bar
>>> 
>>> Karaf will set property foo to bar in etc/com.my.pid.cfg configuratuion
>>> file (aka com.my.pid configuration).
>>> 
>>> You can find some details about this here:
>>> 
>>> https://nanthrax.blogspot.com/2020/11/what-new-in-apache-karaf-430_9.html
>>> 
>>> 
>>> http://karaf.apache.org/manual/latest/#_environment_variables_system_properties
>>> 
>>> Regards
>>> JB
>>> 
>>> On 7/16/21 11:46 AM, Steven Huypens wrote:
>>>> Hi all,
>>>> 
>>>> After upgrading to Karaf 4.3.2 the config file
>>>> org.apache.karaf.management.cfg seems to have changed unexpectedly. For
>>>> example
>>>> 
>>>> *rmiRegistryPort =
>>> ${env:ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYPORT:-1099}*
>>>> 
>>>> has been changed into
>>>> 
>>>> *rmiRegistryPort = 1099*
>>>> 
>>>> Is this intentional ? From
>>> https://issues.apache.org/jira/browse/KARAF-4609
>>>> I understand the environment variables should be included in 4.3 as
>>> well ?
>>>> 
>>>> Kind regards,
>>>> Steven Huypens
>>>> 
>>> 
>>> --
>>> Jean-Baptiste Onofré
>>> jbonofre@apache.org
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>>> 
>> 


Re: KARAF-4609 Be able to override ConfigAdmin properties with System/JVM properties

Posted by Steven Huypens <st...@gmail.com>.
Hi JB,

From your answer I understand that Karaf will actually edit my config-file,
but we don't see this. The application behaviour is as expected, but the
config-file still contains the default values (as does ConfigAdmin), which
might be confusing.

Is that how it is supposed to work, or should I have a closer to look at it?

Kind regards,
Steven

On Fri, Jul 16, 2021 at 4:41 PM Steven Huypens <st...@gmail.com>
wrote:

>
> Thanks, we got it working now !
>
> Steven
>
> On Fri, Jul 16, 2021 at 1:30 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
> wrote:
>
>> Hi,
>>
>> yes, it's normal: the env variable support is now "implicit".
>>
>> You can still use ${env:*} syntax (it's the explicit form), or just the
>> corresponding env variable is enough (implicit).
>>
>> Basically, if you do:
>>
>> export COM_MY_PID_FOO=bar
>>
>> Karaf will set property foo to bar in etc/com.my.pid.cfg configuratuion
>> file (aka com.my.pid configuration).
>>
>> You can find some details about this here:
>>
>> https://nanthrax.blogspot.com/2020/11/what-new-in-apache-karaf-430_9.html
>>
>>
>> http://karaf.apache.org/manual/latest/#_environment_variables_system_properties
>>
>> Regards
>> JB
>>
>> On 7/16/21 11:46 AM, Steven Huypens wrote:
>> > Hi all,
>> >
>> > After upgrading to Karaf 4.3.2 the config file
>> > org.apache.karaf.management.cfg seems to have changed unexpectedly. For
>> > example
>> >
>> > *rmiRegistryPort =
>> ${env:ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYPORT:-1099}*
>> >
>> > has been changed into
>> >
>> > *rmiRegistryPort = 1099*
>> >
>> > Is this intentional ? From
>> https://issues.apache.org/jira/browse/KARAF-4609
>> > I understand the environment variables should be included in 4.3 as
>> well ?
>> >
>> > Kind regards,
>> > Steven Huypens
>> >
>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>

Re: KARAF-4609 Be able to override ConfigAdmin properties with System/JVM properties

Posted by Steven Huypens <st...@gmail.com>.
Thanks, we got it working now !

Steven

On Fri, Jul 16, 2021 at 1:30 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
wrote:

> Hi,
>
> yes, it's normal: the env variable support is now "implicit".
>
> You can still use ${env:*} syntax (it's the explicit form), or just the
> corresponding env variable is enough (implicit).
>
> Basically, if you do:
>
> export COM_MY_PID_FOO=bar
>
> Karaf will set property foo to bar in etc/com.my.pid.cfg configuratuion
> file (aka com.my.pid configuration).
>
> You can find some details about this here:
>
> https://nanthrax.blogspot.com/2020/11/what-new-in-apache-karaf-430_9.html
>
>
> http://karaf.apache.org/manual/latest/#_environment_variables_system_properties
>
> Regards
> JB
>
> On 7/16/21 11:46 AM, Steven Huypens wrote:
> > Hi all,
> >
> > After upgrading to Karaf 4.3.2 the config file
> > org.apache.karaf.management.cfg seems to have changed unexpectedly. For
> > example
> >
> > *rmiRegistryPort =
> ${env:ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYPORT:-1099}*
> >
> > has been changed into
> >
> > *rmiRegistryPort = 1099*
> >
> > Is this intentional ? From
> https://issues.apache.org/jira/browse/KARAF-4609
> > I understand the environment variables should be included in 4.3 as well
> ?
> >
> > Kind regards,
> > Steven Huypens
> >
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: KARAF-4609 Be able to override ConfigAdmin properties with System/JVM properties

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

yes, it's normal: the env variable support is now "implicit".

You can still use ${env:*} syntax (it's the explicit form), or just the 
corresponding env variable is enough (implicit).

Basically, if you do:

export COM_MY_PID_FOO=bar

Karaf will set property foo to bar in etc/com.my.pid.cfg configuratuion 
file (aka com.my.pid configuration).

You can find some details about this here:

https://nanthrax.blogspot.com/2020/11/what-new-in-apache-karaf-430_9.html

http://karaf.apache.org/manual/latest/#_environment_variables_system_properties

Regards
JB

On 7/16/21 11:46 AM, Steven Huypens wrote:
> Hi all,
> 
> After upgrading to Karaf 4.3.2 the config file
> org.apache.karaf.management.cfg seems to have changed unexpectedly. For
> example
> 
> *rmiRegistryPort = ${env:ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYPORT:-1099}*
> 
> has been changed into
> 
> *rmiRegistryPort = 1099*
> 
> Is this intentional ? From https://issues.apache.org/jira/browse/KARAF-4609
> I understand the environment variables should be included in 4.3 as well ?
> 
> Kind regards,
> Steven Huypens
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com