How to use environment variable in nuxeo.conf?

Hi,

I am trying to use a environment variable in nuxeo.conf. I am using Ubuntu 14.04.1 LTS.

I installed Nuxeo through apt-get from the Nuxeo repository.

I added “DBHOST=localhost” to “/etc/environment” then sourced the file.

When I do “echo $DBHOST” I get the output “localhost”.

Then I changed the db.host line in nuxeo.conf to “nuxeo.db.host=${DBHOST}” but when I start the server it fails because it cannot connect to the database.

It works fine if I do “nuxeo.db.host=localhost”.

0 votes

1 answers

2163 views

ANSWER



Unfortunately there is no support in nuxeo.conf to read environment variables.

What you could do is change nuxeoctl to upate/rewrite nuxeo.conf with your environment variable before the normal startup.

0 votes



From http://doc.nuxeo.com/display/ADMINDOC/How+to+Create+a+Nuxeo+Static+WAR "How not to hardcode some properties

It is possible to keep some "dynamic" aspect on some parameters by giving them a variable as value: for instance, nuxeo.db.host=${custom.nuxeo.db.host} Then, you can use the produced Nuxeo WAR in an environment where custom.nuxeo.db.host is defined from outside."

From http://doc.nuxeo.com/pages/viewpage.action?pageId=3866689 "Those parameters can be either environment parameters used by Nuxeo runtime or template parameters used for values replacement in configuration files."

Is this correct? Can you elborate?

01/15/2015

The wording is not meant to refer to OS environment variables. We'll rephrase that, thanks for the pointers.
01/16/2015