blob: fd7c25915eca45d1417f82dc8fb2dc388c08e370 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001# Copyright 2016 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file or at
4# https://developers.google.com/open-source/licenses/bsd
5
6"""Main program for Monorail.
7
8Monorail is an issue tracking tool that is based on the code.google.com
9issue tracker, but it has been ported to Google AppEngine and Google Cloud SQL.
10"""
11from __future__ import print_function
12from __future__ import division
13from __future__ import absolute_import
14
15import logging
16import webapp2
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +020017from werkzeug.middleware import dispatcher
Copybara854996b2021-09-07 19:36:02 +000018
19from components import endpoints_webapp2
Copybara854996b2021-09-07 19:36:02 +000020import gae_ts_mon
21
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +020022import flaskregisterpages
Copybara854996b2021-09-07 19:36:02 +000023import registerpages
Adrià Vilanova Martínezde942802022-07-15 14:06:55 +020024from framework import sorting
Copybara854996b2021-09-07 19:36:02 +000025from services import api_svc_v1
26from services import service_manager
27
28
29services = service_manager.set_up_services()
30sorting.InitializeArtValues(services)
31registry = registerpages.ServletRegistry()
32app_routes = registry.Register(services)
33app = webapp2.WSGIApplication(
34 app_routes, config={'services': services})
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +020035# TODO(crbug.com/1322775) Migrate away from the shared prodx-mon-chrome-infra
36# service account and change to gae_ts_mon.initialize_prod()
37gae_ts_mon.initialize_adhoc(app)
38
39flask_regist = flaskregisterpages.ServletRegistry()
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +020040app = dispatcher.DispatcherMiddleware(
Adrià Vilanova Martínezde942802022-07-15 14:06:55 +020041 app,
42 {
43 '/hosting_old': flask_regist.RegisterOldHostUrl(services),
44 '/projects': flask_regist.RegisterRedirectProjectUrl(),
45 # '/_': flask_regist.RegisterMONSetUrl(services),
46 # '/hosting': flask_regist.RegisterHostingUrl(services),
47 # '/g': flask_regist.RegisterGroupUrls(services),
48 # '/p': flask_regist.RegisterProjectUrls(services),
49 # '/u': flask_regist.RegisterUserUrls(services),
50 # '/_task': flask_regist.RegisterTaskUrl(services),
51 # '/_cron': flask_regist.RegisterCronUrl(services),
52 # '/_backend': flask_regist.RegisterBackendUrl(services),
53 # '/_ah': flask_regist.RegisterAHUrl(services),
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +020054 })
Copybara854996b2021-09-07 19:36:02 +000055
56endpoints = endpoints_webapp2.api_server(
57 [api_svc_v1.MonorailApi, api_svc_v1.ClientConfigApi])