From c126deaab515339cd83bebcfc1bcc8aebe24e47f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 4 Apr 2022 00:08:59 +0200 Subject: [PATCH] Allow setting wsgi configuration with environment variables issue11307 review375031002 --- doc/topics/configuration.rst | 4 ++++ trytond/config.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/doc/topics/configuration.rst b/doc/topics/configuration.rst index cbd24484f0..458a2e8c60 100644 --- a/doc/topics/configuration.rst +++ b/doc/topics/configuration.rst @@ -645,6 +645,10 @@ Example:: [wsgi ie] kwargs={'fix_attach': False} +.. note:: + The options can be set using environment variables with names like: + ``TRYTOND_WSGI___``. + .. _JSON-RPC: http://en.wikipedia.org/wiki/JSON-RPC .. _XML-RPC: http://en.wikipedia.org/wiki/XML-RPC diff --git a/trytond/config.py b/trytond/config.py index 4974721ae6..b44032fe3f 100644 --- a/trytond/config.py +++ b/trytond/config.py @@ -106,6 +106,8 @@ class TrytonConfigParser(configparser.ConfigParser): section, option = key[len('TRYTOND_'):].lower().split('__', 1) except ValueError: continue + if section.startswith('wsgi_'): + section = section.replace('wsgi_', 'wsgi ') if not self.has_section(section): self.add_section(section) self.set(section, option, value)