# HG changeset patch # User Marcin Kuzminski # Date 2019-09-26 09:16:58 # Node ID 442d1efea8ebcdca3c86f678cce2a1401f871446 # Parent 6eec8d9eb08cae3dea6338cd1ae05fdb0f99a284 service: expose config so enterprise can read it. diff --git a/vcsserver/http_main.py b/vcsserver/http_main.py --- a/vcsserver/http_main.py +++ b/vcsserver/http_main.py @@ -468,23 +468,31 @@ class HTTPApplication(object): import vcsserver payload = msgpack.unpackb(request.body, use_list=True) + server_config, app_config = {}, {} try: path = self.global_config['__file__'] - config = configparser.ConfigParser() + config = configparser.RawConfigParser() + config.read(path) - parsed_ini = config - if parsed_ini.has_section('server:main'): - parsed_ini = dict(parsed_ini.items('server:main')) + + if config.has_section('server:main'): + server_config = dict(config.items('server:main')) + if config.has_section('app:main'): + app_config = dict(config.items('app:main')) + except Exception: log.exception('Failed to read .ini file for display') - parsed_ini = {} + + environ = os.environ.items() resp = { 'id': payload.get('id'), 'result': dict( version=vcsserver.__version__, - config=parsed_ini, + config=server_config, + app_config=app_config, + environ=environ, payload=payload, ) }