##// END OF EJS Templates
service-endpoint: expose additional data of vcsserver via service-data endpoint....
marcink -
r173:d7a24340 default
parent child Browse files
Show More
@@ -153,8 +153,10 b' class HTTPApplication(object):'
153 153 remote_wsgi = remote_wsgi
154 154 _use_echo_app = False
155 155
156 def __init__(self, settings=None):
156 def __init__(self, settings=None, global_config=None):
157 157 self.config = Configurator(settings=settings)
158 self.global_config = global_config
159
158 160 locale = settings.get('locale', '') or 'en_US.UTF-8'
159 161 vcs = VCS(locale=locale, cache_config=settings)
160 162 self._remotes = {
@@ -273,12 +275,26 b' class HTTPApplication(object):'
273 275
274 276 def service_view(self, request):
275 277 import vcsserver
278 import ConfigParser as configparser
279
276 280 payload = msgpack.unpackb(request.body, use_list=True)
281
282 try:
283 path = self.global_config['__file__']
284 config = configparser.ConfigParser()
285 config.read(path)
286 parsed_ini = config
287 if parsed_ini.has_section('server:main'):
288 parsed_ini = dict(parsed_ini.items('server:main'))
289 except Exception:
290 log.exception('Failed to read .ini file for display')
291 parsed_ini = {}
292
277 293 resp = {
278 294 'id': payload.get('id'),
279 295 'result': dict(
280 296 version=vcsserver.__version__,
281 config={},
297 config=parsed_ini,
282 298 payload=payload,
283 299 )
284 300 }
@@ -404,5 +420,5 b' def main(global_config, **settings):'
404 420 if MercurialFactory:
405 421 hgpatches.patch_largefiles_capabilities()
406 422 hgpatches.patch_subrepo_type_mapping()
407 app = HTTPApplication(settings=settings)
423 app = HTTPApplication(settings=settings, global_config=global_config)
408 424 return app.wsgi_app()
General Comments 0
You need to be logged in to leave comments. Login now