diff --git a/README.md b/README.md index f025b1d9..1aa2b480 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,9 @@ subsequently run. Files here will be environment-variable-expanded and concatenated in `/opt/odoo/auto/odoo.conf` in the entrypoint. +You can use a different custom directory to concatenate the configuration by using the +`CUSTOM_CONF_DIR` environment variable in the odoo service of the compose specific file. + #### `/opt/odoo/custom/ssh` It must follow the same structure as a standard `~/.ssh` directory, including `config` diff --git a/bin/config-generate b/bin/config-generate index 7865890d..01d96b55 100755 --- a/bin/config-generate +++ b/bin/config-generate @@ -27,6 +27,9 @@ except ImportError: ODOO_VERSION = os.environ.get("ODOO_VERSION") TARGET_FILE = os.environ.get("ODOO_RC", "/opt/odoo/auto/odoo.conf") CONFIG_DIRS = ("/opt/odoo/common/conf.d", "/opt/odoo/custom/conf.d") +CUSTOM_CONF_DIR = os.environ.get("CUSTOM_CONF_DIR") +if CUSTOM_CONF_DIR: + CONFIG_DIRS += (CUSTOM_CONF_DIR,) CONFIG_FILES = [] # Read all configuraiton files found in those folders diff --git a/tests/__init__.py b/tests/__init__.py index 0cfcff66..5bb64581 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -384,7 +384,8 @@ def _check_dotd(self, scaffolding_dir, odoo_skip): # ``custom/entrypoint.d`` was properly executed ("test", "-f", "/home/odoo/created-at-entrypoint"), # ``custom/conf.d`` was properly concatenated - ("grep", "test-conf", "auto/odoo.conf"), + ("grep", "-F", "[conf]", "auto/odoo.conf"), + ("grep", "-F", "[test-conf]", "auto/odoo.conf"), # ``custom/dependencies`` were installed ("test", "!", "-e", "/usr/sbin/sshd"), ("test", "!", "-e", "/var/lib/apt/lists/lock"), diff --git a/tests/scaffoldings/dotd/custom/conf.d/test-conf b/tests/scaffoldings/dotd/custom/conf-test.d/test-conf similarity index 100% rename from tests/scaffoldings/dotd/custom/conf.d/test-conf rename to tests/scaffoldings/dotd/custom/conf-test.d/test-conf diff --git a/tests/scaffoldings/dotd/custom/conf.d/conf b/tests/scaffoldings/dotd/custom/conf.d/conf new file mode 100644 index 00000000..35b36b68 --- /dev/null +++ b/tests/scaffoldings/dotd/custom/conf.d/conf @@ -0,0 +1 @@ +[conf] diff --git a/tests/scaffoldings/dotd/docker-compose.yaml b/tests/scaffoldings/dotd/docker-compose.yaml index fbbaec8d..86813e6a 100644 --- a/tests/scaffoldings/dotd/docker-compose.yaml +++ b/tests/scaffoldings/dotd/docker-compose.yaml @@ -12,6 +12,7 @@ services: PGPASSWORD: anotherodoopassword PGHOST: postgresql PGDATABASE: ${DBNAME:-prod} + CUSTOM_CONF_DIR: "/opt/odoo/custom/conf-test.d" depends_on: - postgresql volumes: diff --git a/tests/scaffoldings/dotd_ge_16/custom/conf.d/test-conf b/tests/scaffoldings/dotd_ge_16/custom/conf-test.d/test-conf similarity index 100% rename from tests/scaffoldings/dotd_ge_16/custom/conf.d/test-conf rename to tests/scaffoldings/dotd_ge_16/custom/conf-test.d/test-conf diff --git a/tests/scaffoldings/dotd_ge_16/custom/conf.d/conf b/tests/scaffoldings/dotd_ge_16/custom/conf.d/conf new file mode 100644 index 00000000..35b36b68 --- /dev/null +++ b/tests/scaffoldings/dotd_ge_16/custom/conf.d/conf @@ -0,0 +1 @@ +[conf] diff --git a/tests/scaffoldings/dotd_ge_16/docker-compose.yaml b/tests/scaffoldings/dotd_ge_16/docker-compose.yaml index fbbaec8d..86813e6a 100644 --- a/tests/scaffoldings/dotd_ge_16/docker-compose.yaml +++ b/tests/scaffoldings/dotd_ge_16/docker-compose.yaml @@ -12,6 +12,7 @@ services: PGPASSWORD: anotherodoopassword PGHOST: postgresql PGDATABASE: ${DBNAME:-prod} + CUSTOM_CONF_DIR: "/opt/odoo/custom/conf-test.d" depends_on: - postgresql volumes: