Just to be clear: today I’m using an "explicit" approach, where the config
contains something like:
sshPort=${env:KARAF_SSH_PORT:-8101}
But we can also have "implicit" approach (with some more changes required).
Regards
JB
> Le 28 sept. 2020 à 11:07, Jean-Baptiste Onofre <[email protected]> a écrit :
>
> Hi,
>
> At beginning, I did a very simple change in Karaf Main: for instance, you
> would be able to do
>
> Bin/karaf -Dpid:prop=value
>
> And I init the configuration file with the value.
>
> However, system properties are not super easy with docker.
>
> That’s why I preferred the env variable approach.
>
> Now, about env variable, I just leverage what we already have in Karaf (just
> updating the default configuration file).
>
> I can do a new iteration where (in configadmin repository), I’m checking ALL
> env variables to find one matching.
> It would mean something like:
>
> $ export KARAF.MY_PID.prop=value
>
> For instance.
>
> We would need a "env variable format".
>
> Thoughts ?
>
> Regards
> JB
>
>> Le 28 sept. 2020 à 10:59, Grzegorz Grzybek <[email protected]
>> <mailto:[email protected]>> a écrit :
>>
>> Hello
>>
>> Good idea!
>>
>> Shouldn't configadmin do it by default?
>>
>> Like dissect "KARAF_SSH_PORT" or similar env variables into:
>> - prefix (KARAF_) - rejected
>> - PID pointer (e.g., SSH → org.apache.karaf.shell)
>> - property (e.g PORT → sshPort)
>> ?
>>
>> This way it could be done in one place... Just my random observation,
>> because I can't dig this problem further for now ;)
>>
>> regards
>> Grzegorz Grzybek
>>
>> pon., 28 wrz 2020 o 10:51 Jean-Baptiste Onofre <[email protected]
>> <mailto:[email protected]> <mailto:[email protected]
>> <mailto:[email protected]>>> napisał(a):
>>
>>> Hi guys,
>>>
>>> In order to easily use Karaf in docker container, I created the following
>>> PR:
>>>
>>> https://github.com/apache/karaf/pull/1203
>>> <https://github.com/apache/karaf/pull/1203>
>>> <https://github.com/apache/karaf/pull/1203
>>> <https://github.com/apache/karaf/pull/1203>> <
>>> https://github.com/apache/karaf/pull/1203
>>> <https://github.com/apache/karaf/pull/1203>
>>> <https://github.com/apache/karaf/pull/1203
>>> <https://github.com/apache/karaf/pull/1203>>>
>>>
>>> The purpose is allow use to override some configuration properties using
>>> env variables.
>>>
>>> For instance, if you want to use 8102 instead of default 8101 ssh port
>>> number, you can do:
>>>
>>> $ export KARAF_SSH_PORT=8102
>>> $ bin/karaf
>>>
>>> I listed the environment variables here:
>>>
>>> https://github.com/apache/karaf/blob/4eda325e73d1d7dfbc0508258bde582e93d4f05e/manual/src/main/asciidoc/user-guide/configuration.adoc
>>>
>>> <https://github.com/apache/karaf/blob/4eda325e73d1d7dfbc0508258bde582e93d4f05e/manual/src/main/asciidoc/user-guide/configuration.adoc>
>>> <
>>> https://github.com/apache/karaf/blob/4eda325e73d1d7dfbc0508258bde582e93d4f05e/manual/src/main/asciidoc/user-guide/configuration.adoc
>>>
>>> <https://github.com/apache/karaf/blob/4eda325e73d1d7dfbc0508258bde582e93d4f05e/manual/src/main/asciidoc/user-guide/configuration.adoc>
>>>>
>>>
>>> I didn’t define environment variables for all properties. If you see some
>>> properties that it would be interesting to override by env variables,
>>> please let me know, I will update the PR.
>>>
>>> NB: I will also update pax* to use similar approach.
>>>
>>> Thoughts ?
>>>
>>> Regards
>>> JB