Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | # 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 | |
| 8 | Monorail is an issue tracking tool that is based on the code.google.com |
| 9 | issue tracker, but it has been ported to Google AppEngine and Google Cloud SQL. |
| 10 | """ |
| 11 | from __future__ import print_function |
| 12 | from __future__ import division |
| 13 | from __future__ import absolute_import |
| 14 | |
| 15 | import logging |
| 16 | import webapp2 |
Adrià Vilanova Martínez | ac4a644 | 2022-05-15 19:05:13 +0200 | [diff] [blame] | 17 | from werkzeug.middleware import dispatcher |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 18 | |
| 19 | from components import endpoints_webapp2 |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 20 | import gae_ts_mon |
| 21 | |
Adrià Vilanova Martínez | ac4a644 | 2022-05-15 19:05:13 +0200 | [diff] [blame] | 22 | import flaskregisterpages |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 23 | import registerpages |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame^] | 24 | from framework import sorting |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 25 | from services import api_svc_v1 |
| 26 | from services import service_manager |
| 27 | |
| 28 | |
| 29 | services = service_manager.set_up_services() |
| 30 | sorting.InitializeArtValues(services) |
| 31 | registry = registerpages.ServletRegistry() |
| 32 | app_routes = registry.Register(services) |
| 33 | app = webapp2.WSGIApplication( |
| 34 | app_routes, config={'services': services}) |
Adrià Vilanova Martínez | ac4a644 | 2022-05-15 19:05:13 +0200 | [diff] [blame] | 35 | # TODO(crbug.com/1322775) Migrate away from the shared prodx-mon-chrome-infra |
| 36 | # service account and change to gae_ts_mon.initialize_prod() |
| 37 | gae_ts_mon.initialize_adhoc(app) |
| 38 | |
| 39 | flask_regist = flaskregisterpages.ServletRegistry() |
Adrià Vilanova Martínez | ac4a644 | 2022-05-15 19:05:13 +0200 | [diff] [blame] | 40 | app = dispatcher.DispatcherMiddleware( |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame^] | 41 | 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ínez | ac4a644 | 2022-05-15 19:05:13 +0200 | [diff] [blame] | 54 | }) |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 55 | |
| 56 | endpoints = endpoints_webapp2.api_server( |
| 57 | [api_svc_v1.MonorailApi, api_svc_v1.ClientConfigApi]) |