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"
This commit is contained in:
Janik von Rotz committed 2025-10-21 17:26:34 +02:00
1 parent 0fbbd5e1b3
commit 5509aaeede
4 files changed
+24 -7

No files matched your search

+3 -1
View File
@@ -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`.
* Inconsistent naming of `DBFILTER` is now `DB_FILTER`.
+10 -1
View File
@@ -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 <https://github.com/acsone/odoo-bedrock> or <https://github.com/Tecnativa/doodba>.
+8 -3
View File
@@ -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}"
+3 -2
View File
@@ -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