Allow setting wsgi configuration with environment variables

issue11307
review375031002
This commit is contained in:
Cédric Krier
2022-04-04 00:08:59 +02:00
parent f24c6e8e87
commit c126deaab5
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -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_<MIDDLEWARE>__<NAME>``.
.. _JSON-RPC: http://en.wikipedia.org/wiki/JSON-RPC
.. _XML-RPC: http://en.wikipedia.org/wiki/XML-RPC
+2
View File
@@ -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)