From dfcb25ae81a129ce5ca17c19ac01f5288593b724 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 10 2015 10:59:48 +0000 Subject: Add the possibility to prefix the URLs via the configuration file --- diff --git a/mdapi/__init__.py b/mdapi/__init__.py index 943f9b8..5468f83 100644 --- a/mdapi/__init__.py +++ b/mdapi/__init__.py @@ -180,12 +180,26 @@ def index(request): @asyncio.coroutine def init(loop): app = web.Application(loop=loop) - app.router.add_route('GET', '/', index) - app.router.add_route('GET', '/branches', list_branches) - app.router.add_route('GET', '/{branch}/pkg/{name}', get_pkg) - app.router.add_route('GET', '/{branch}/files/{name}', get_pkg_files) app.router.add_route( - 'GET', '/{branch}/changelog/{name}', get_pkg_changelog) + 'GET', + '%s/' % CONFIG.get('PREFIX', ''), + index) + app.router.add_route( + 'GET', + '%s/branches' % CONFIG.get('PREFIX', ''), + list_branches) + app.router.add_route( + 'GET', + '%s/{branch}/pkg/{name}' % CONFIG.get('PREFIX', ''), + get_pkg) + app.router.add_route( + 'GET', + '%s/{branch}/files/{name}' % CONFIG.get('PREFIX', ''), + get_pkg_files) + app.router.add_route( + 'GET', + '%s/{branch}/changelog/{name}' % CONFIG.get('PREFIX', ''), + get_pkg_changelog) srv = yield from loop.create_server( app.make_handler(),