Search code examples
odooodoo-11

How to use an environment variable in the odoo.conf


I am trying to use an environment variable in the odoo.conf file to specify the path where the logs are stored. So far I have tried:

logfile = ${test.rueda}/odoo.log

But it does not work. Is there any way to achieve this?


Solution

  • The Odoo configuration files do not support access to environment variables.

    I can think of 2 possible approaches:

    • Use relative paths. The file names in the configuration are relative to the working directory of the Odoo server process. Start the Odoo server in different directories, one for every purpose, and keep the same structure relative to that.

    • Use environment variables in the command line. When starting the Odoo server, any configuration option can be passed using -- (2 dash signs) as a prefix. In the start script, you can then use environment variables as in any other shell script. See https://www.odoo.com/documentation/11.0/reference/cmdline.html for details.