From 5509aaeede2014b2d21175a76552e4847feeb36c Mon Sep 17 00:00:00 2001 From: Janik von Rotz Date: Tue, 21 Oct 2025 17:26:34 +0200 Subject: [PATCH] feat(config): add support for custom odoo.conf sections via env vars - Introduce `ADDITIONAL_ODOO_RC` to append custom config to main section - Introduce `IR_CONFIG_PARAMETER` to append to ir config section - Move SSH key parameters from separate variables to `IR_CONFIG_PARAMETER` - Update documentation and examples for new configuration options - Fix inconsistent heading in README from "Test" to "Testing" --- images/odoo/CHANGELOG.md | 4 +++- images/odoo/README.md | 11 ++++++++++- images/odoo/bin/template-odoo-rc | 11 ++++++++--- images/odoo/odoo.conf.template | 5 +++-- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/images/odoo/CHANGELOG.md b/images/odoo/CHANGELOG.md index 50b95f19..4130cfef 100644 --- a/images/odoo/CHANGELOG.md +++ b/images/odoo/CHANGELOG.md @@ -9,6 +9,8 @@ All notable changes to this project will be documented in this file. The format * Support `git-aggregator`. * Split SSH key management into `add-ssh-key` and `remove-ssh-key`. * Add new env vars: `DB_MAXCONN`, `LOG_DB`, `LOG_HANDLER`, `LOGFILE`, `LIMIT_MEMORY_HARD`, `LIMIT_MEMORY_SOFT`, `LIMIT_MEMORY_HARD_GEVENT`, `LIMIT_MEMORY_SOFT_GEVENT`. +* Env var `ADDITIONAL_ODOO_RC` to append custom config to main section. +* Env var `IR_CONFIG_PARAMETER` to append to ir config section. ### Updated @@ -21,4 +23,4 @@ All notable changes to this project will be documented in this file. The format ### Fixed -* Inconsistent naming of `DBFILTER` is now `DB_FILTER`. \ No newline at end of file +* Inconsistent naming of `DBFILTER` is now `DB_FILTER`. diff --git a/images/odoo/README.md b/images/odoo/README.md index cb7cc4f2..11abe00f 100644 --- a/images/odoo/README.md +++ b/images/odoo/README.md @@ -158,6 +158,8 @@ services: TEST_EXCLUDE: partner_fax AUTO_UPDATE_TRANSLATIONS: True AUTO_UPDATE_MODULES_LIST: True + ADDITIONAL_ODOO_RC: "syslog = True" + IR_CONFIG_PARAMETER: "web.base.url = https://odoo.example.com" ports: - "127.0.0.1:8069:8069" volumes: @@ -447,7 +449,7 @@ The container uses [click-odoo-contrib](https://github.com/acsone/click-odoo-con Both options require `ODOO_DATABASE` and `ODOO_ADDONS_PATH`. -### Test +### Testing With this image you can also run module tests. @@ -455,6 +457,13 @@ With this image you can also run module tests. * `TEST_INCLUDE` Comma separated list of modules that should be test exlusively. * `TEST_EXCLUDE`: Comma separated list of modules that should not be tested. +### Additional Config + +If you have additional config for Odoo use the vars: + +* `ADDITIONAL_ODOO_RC`: Added to the main section of the odoo.conf. +* `IR_CONFIG_PARAMETER`: Added to the `ir.config_parameter` section of the odoo.conf. + ### Naming This image tries to stay compatible with other images such as or . diff --git a/images/odoo/bin/template-odoo-rc b/images/odoo/bin/template-odoo-rc index c90db73c..c52ab916 100755 --- a/images/odoo/bin/template-odoo-rc +++ b/images/odoo/bin/template-odoo-rc @@ -28,13 +28,18 @@ export LIMIT_MEMORY_SOFT=${LIMIT_TIME_REAL:=""} export LIMIT_MEMORY_HARD_GEVENT=${LIMIT_TIME_REAL:=""} export LIMIT_MEMORY_SOFT_GEVENT=${LIMIT_TIME_REAL:=""} export MODULE_AUTO_INSTALL_DISABLED=${MODULE_AUTO_INSTALL_DISABLED:=""} +export ADDITIONAL_ODOO_RC=${ADDITIONAL_ODOO_RC:=""} +export IR_CONFIG_PARAMETER=${IR_CONFIG_PARAMETER:=""} -# Deode SSH private key +# Add SSH keys to conf if [ -n "$GIT_SSH_PRIVATE_KEY" ]; then GIT_SSH_PRIVATE_KEY=$(echo -e "$GIT_SSH_PRIVATE_KEY" | base64 -w0) + IR_CONFIG_PARAMETER+=$'\n'"git.ssh_private_key = \"$GIT_SSH_PRIVATE_KEY\"" fi -export GIT_SSH_PUBLIC_KEY_PARAM=$([ -n "$GIT_SSH_PUBLIC_KEY" ] && echo "git.ssh.public.key = \"$GIT_SSH_PUBLIC_KEY\"") -export GIT_SSH_PRIVATE_KEY_PARAM=$([ -n "$GIT_SSH_PRIVATE_KEY" ] && echo "git.ssh.private.key = \"$GIT_SSH_PRIVATE_KEY\"") +if [ -n "$GIT_SSH_PUBLIC_KEY" ]; then + IR_CONFIG_PARAMETER+=$'\n'"git.ssh_public_key = \"$GIT_SSH_PUBLIC_KEY\"" +fi +export IR_CONFIG_PARAMETER TEMPLATE_FILE="${ODOO_ENVSUBST_TEMPLATE_FILE:-/etc/odoo/odoo.conf.template}" OUTPUT_FILE="${ODOO_ENVSUBST_OUTPUT_FILE:-/etc/odoo/odoo.conf}" diff --git a/images/odoo/odoo.conf.template b/images/odoo/odoo.conf.template index 491bf629..d22f6627 100644 --- a/images/odoo/odoo.conf.template +++ b/images/odoo/odoo.conf.template @@ -31,6 +31,7 @@ limit_memory_hard_gevent = $LIMIT_MEMORY_HARD_GEVENT limit_memory_soft_gevent = $LIMIT_MEMORY_SOFT_GEVENT modules_auto_install_disabled = $MODULE_AUTO_INSTALL_DISABLED +$ADDITIONAL_ODOO_RC + [ir.config_parameter] -$GIT_SSH_PUBLIC_KEY_PARAM -$GIT_SSH_PRIVATE_KEY_PARAM +$IR_CONFIG_PARAMETER