Hi Oliver,

I think it just works fine but you don't look at right place ;)

Actually, when you use the env variable, the config is updated in memory but not in the file.

Let me illustrate this:

1. I have a config file etc/org.ops4j.pax.web.cfg containing:

org.osgi.service.http.port=8181

2. I set the env variable:

export ORG_OPS4J_PAX_WEB_ORG_OSGI_SERVICE_HTTP_PORT=8186

3. The file is not changed but if you take a look on the config it actually uses 8186, as you can see in Karaf:

karaf@root()> config:list "(service.pid=org.ops4j.pax.web)"
----------------------------------------------------------------
Pid:            org.ops4j.pax.web
BundleLocation: mvn:org.ops4j.pax.web/pax-web-runtime/7.3.23
Properties:
felix.fileinstall.filename = file:/home/jbonofre/Downloads/apache-karaf-4.3.5/etc/org.ops4j.pax.web.cfg javax.servlet.context.tempdir = /home/jbonofre/Downloads/apache-karaf-4.3.5/data/pax-web-jsp
   org.apache.karaf.features.configKey = org.ops4j.pax.web
org.ops4j.pax.web.config.file = /home/jbonofre/Downloads/apache-karaf-4.3.5/etc/jetty.xml
   org.osgi.service.http.port = 8186
   service.pid = org.ops4j.pax.web


So, you can check using config:list command in Karaf, it should be OK ;)

Regards
JB

On 25/01/2022 14:19, Oliver Fürniß wrote:
Greetings,

I try to overwrite a configuration (Karaf 4.3.3) by using environment variables like mentioned in the Karaf documentation: https://svn.apache.org/repos/asf/karaf/site/production/manual/latest/configuration.html <https://svn.apache.org/repos/asf/karaf/site/production/manual/latest/configuration.html>

It works fine for simple names like `sshPort`, but fails when the variable name is separated by dots.

Example:

Config file:
[karaf]/etc/org.ops4j.pax.web.cfg

Configuration to overwrite in file:
org.osgi.service.http.port = 8181

Set environment variable:
export ORG_OPS4J_PAX_WEB_ORG_OSGI_SERVICE_HTTP_PORT=8186

This does not set the new value. Something I'm doing wrong? Or maybe it looks for a file called `org.ops4j.pax.web.org.osgi.service.http.cfg` to set/overwrite 'port'?

All the best,
  Oliver

Reply via email to