Commit 80faf9c3 authored by Nicolas Delaby's avatar Nicolas Delaby

Reads from configuration file environment variables.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@42226 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a6fc7dfe
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
import gc import gc
from signal import signal, SIGHUP from signal import signal, SIGHUP
from os import path, mkdir from os import path, mkdir
import os
import cloudooo.handler.ooo.monitor as monitor import cloudooo.handler.ooo.monitor as monitor
from cloudooo.handler.ooo.application.openoffice import openoffice from cloudooo.handler.ooo.application.openoffice import openoffice
...@@ -62,6 +63,18 @@ def application(global_config, **local_config): ...@@ -62,6 +63,18 @@ def application(global_config, **local_config):
uno_path -- Full path to pyuno library. uno_path -- Full path to pyuno library.
e.g uno_path='/opt/openoffice.org/program' e.g uno_path='/opt/openoffice.org/program'
""" """
prefix = 'env-'
environment_dict = {}
for parameter_name, value in local_config.iteritems():
if value and parameter_name[:len(prefix)] == prefix:
variable_name = parameter_name[len(prefix):].upper()
if variable_name == 'PATH':
# merge only for PATH
current_value = os.environ.get(variable_name, '')
if current_value:
value = current_value + ':' + value
environment_dict[variable_name] = value
gc.enable() gc.enable()
debug_mode = convertStringToBool(local_config.get('debug_mode')) debug_mode = convertStringToBool(local_config.get('debug_mode'))
configureLogger(debug_mode=debug_mode) configureLogger(debug_mode=debug_mode)
...@@ -94,6 +107,7 @@ def application(global_config, **local_config): ...@@ -94,6 +107,7 @@ def application(global_config, **local_config):
local_config.get('uno_path'), local_config.get('uno_path'),
local_config.get('openoffice_user_interface_language', local_config.get('openoffice_user_interface_language',
'en'), 'en'),
environment_dict=environment_dict,
) )
openoffice.start() openoffice.start()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment