Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 1 | # Copyright 2016 The Chromium Authors |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 4 | |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 5 | """Defines settings for the avm99963 bugs monorail instance.""" |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 6 | from __future__ import print_function |
| 7 | from __future__ import division |
| 8 | from __future__ import absolute_import |
| 9 | |
| 10 | import os |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 11 | import six |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 12 | |
| 13 | from google.appengine.api import app_identity |
| 14 | |
| 15 | from framework import framework_constants |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 16 | from mrproto import project_pb2 |
| 17 | from mrproto import site_pb2 |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 18 | |
| 19 | |
| 20 | # This file is divided into the following parts: |
| 21 | # 1. Settings you must edit before deploying your site. |
| 22 | # 2. Settings you would edit on certain occasions while maintaining your site. |
| 23 | # 3. Settings enable specific features. |
| 24 | # 4. Settings that you can usually leave as-is. |
| 25 | |
| 26 | # TODO(jrobbins): Store these settings in the database and implement |
| 27 | # servlets for domain admins to edit them without needing to redeploy the |
| 28 | # app. |
| 29 | |
| 30 | |
| 31 | #### |
| 32 | # Part 1: settings that you must edit before deploying your site. |
| 33 | |
| 34 | # Email address that is offered to users who might need help using the tool. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 35 | feedback_email = 'me+monorail.feedback@avm99963.com' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 36 | |
| 37 | # For debugging when running in staging: send all outbound |
| 38 | # email to this address rather than to the actual address that |
| 39 | # it would normally be sent to. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 40 | send_all_email_to = 'monorail-staging-emails+all+%(user)s+%(domain)s@dontsend.avm99963.com' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 41 | |
| 42 | # For debugging when running the server locally: send all outbound |
| 43 | # email to this address rather than to the actual address that |
| 44 | # it would normally be sent to. |
| 45 | send_local_email_to = ( |
| 46 | send_all_email_to or |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 47 | 'monorail-staging-emails+dev+%(user)s+%(domain)s@dontsend.avm99963.com') |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 48 | |
| 49 | # User to send emails from Monorail as. The reply_to sections of emails will be |
| 50 | # set to appspotmail addresses. |
| 51 | # Note: If configuring a new monorail instance without DNS records and reserved |
| 52 | # email addresses then setting these values to |
| 53 | # 'reply@${app_id}.appspotmail.com' and 'noreply@{app_id}.appspotmail.com' |
| 54 | # is likely the best option. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 55 | |
| 56 | # Old values (TODO: set up DNS records and uncomment this): |
| 57 | #send_email_as_format = 'monorail@%(domain)s' |
| 58 | #send_noreply_email_as_format = 'monorail+noreply@%(domain)s' |
| 59 | |
| 60 | send_email_as_format = 'reply@avm99963-bugs.appspotmail.com' |
| 61 | send_noreply_email_as_format = 'noreply@avm99963-bugs.appspotmail.com' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 62 | |
| 63 | # The default is to look for a database named "monorail" in replicas |
| 64 | # named "replica-00" .. "replica-09" |
| 65 | # Replica names for -prod, -staging, and -dev may diverge if replicas ever fail. |
| 66 | # In such cases the db_replica_names list can be overwritten in Part 5. |
| 67 | db_database_name = 'monorail' |
| 68 | db_primary_name = 'primary' |
| 69 | db_replica_prefix = 'replica' |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 70 | db_region = 'europe-west1' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 71 | |
| 72 | # The default connection pool size for mysql connections. |
| 73 | db_cnxn_pool_size = 20 |
| 74 | |
| 75 | # The number of logical database shards used. Each replica is complete copy |
| 76 | # of the primary, so any replica DB can answer queries about any logical shard. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 77 | num_logical_shards = 1 |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 78 | |
| 79 | # "Learn more" link for the site home page |
| 80 | learn_more_link = None |
| 81 | |
| 82 | # Site name, displayed above the search box on the site home page. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 83 | site_name = 'avm99963 bugs' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 84 | |
| 85 | # Who is allowed to create new projects? Set to ANYONE or ADMIN_ONLY. |
| 86 | project_creation_restriction = site_pb2.UserTypeRestriction.ADMIN_ONLY |
| 87 | |
| 88 | # Default access level when creating a new project. |
| 89 | default_access_level = project_pb2.ProjectAccess.ANYONE |
| 90 | |
| 91 | # Possible access levels to offer when creating a new project. |
| 92 | allowed_access_levels = [ |
| 93 | project_pb2.ProjectAccess.ANYONE, |
| 94 | project_pb2.ProjectAccess.MEMBERS_ONLY] |
| 95 | |
| 96 | # Who is allowed to create user groups? Set to ANYONE or ADMIN_ONLY. |
| 97 | group_creation_restriction = site_pb2.UserTypeRestriction.ADMIN_ONLY |
| 98 | |
| 99 | # Who is allowed to create hotlists? Set to ANYONE or ADMIN_ONLY. |
| 100 | hotlist_creation_restriction = site_pb2.UserTypeRestriction.ANYONE |
| 101 | |
| 102 | # Text that mentions these words as shorthand host names will be autolinked |
| 103 | # regardless of the lack of "https://" or ".com". |
| 104 | autolink_shorthand_hosts = [ |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 105 | 'go', |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 106 | ] |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 107 | autolink_numeric_shorthand_hosts = [] |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 108 | |
| 109 | |
| 110 | # We only allow self-service account linking invites when the child account is |
| 111 | # linking to a parent account in an allowed domain. |
| 112 | linkable_domains = { |
| 113 | # Child account domain: [parent account domains] |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | |
| 117 | #### |
| 118 | # Part 2: Settings you would edit on certain occasions. |
| 119 | |
| 120 | # Read-only mode prevents changes while we make server-side changes. |
| 121 | read_only = False |
| 122 | |
| 123 | # Timestamp used to notify users when the read only mode or other status |
| 124 | # described in the banner message takes effect. It is |
| 125 | # expressed as a tuple of ints: (year, month, day[, hour[, minute[, second]]]) |
| 126 | # e.g. (2009, 3, 20, 21, 45) represents March 20 2009 9:45PM UTC. |
| 127 | banner_time = None |
| 128 | |
| 129 | # Display a site maintenance banner on every monorail page. |
| 130 | banner_message = '' |
| 131 | |
| 132 | # User accounts with email addresses at these domains are all banned. |
| 133 | banned_user_domains = [] |
| 134 | |
| 135 | # We use this for specifying cloud task parent |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 136 | CLOUD_TASKS_REGION = 'europe-west1' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 137 | |
| 138 | # We only send subscription notifications to users who have visited the |
| 139 | # site in the last 6 months. |
| 140 | subscription_timeout_secs = 180 * framework_constants.SECS_PER_DAY |
| 141 | |
| 142 | # Location of GCS spam classification staging trainer. Whenever the training |
| 143 | # code is changed, this should be updated to point to the new package. |
| 144 | trainer_staging = ('gs://monorail-staging-mlengine/spam_trainer_1517870972/' |
| 145 | 'packages/befc9b29d9beb7e89d509bd1e9866183c138e3a32317cc' |
| 146 | 'e253342ac9f8e7c375/trainer-0.1.tar.gz') |
| 147 | |
| 148 | # Location of GCS spam classification prod trainer. Whenever the training |
| 149 | # code is changed, this should be updated to point to the new package. |
| 150 | trainer_prod = ('gs://monorail-prod-mlengine/spam_trainer_1521755738/packages/' |
| 151 | '3339dfcb5d7b6c9d714fb9b332fd72d05823e9a1850ceaf16533a6124bcad' |
| 152 | '6fd/trainer-0.1.tar.gz') |
| 153 | #### |
| 154 | # Part 3: Settings that enable specific features |
| 155 | |
| 156 | # Enables "My projects" drop down menu |
| 157 | enable_my_projects_menu = True |
| 158 | |
| 159 | # Enables stars in the UI for projects |
| 160 | enable_project_stars = True |
| 161 | |
| 162 | # Enables stars in the UI for users |
| 163 | enable_user_stars = True |
| 164 | |
| 165 | # Enable quick edit mode in issue peek dialog and show dialog on hover |
| 166 | enable_quick_edit = True |
| 167 | |
| 168 | |
| 169 | #### |
| 170 | # Part 4: Settings that you can usually leave as-is. |
| 171 | |
| 172 | # local_mode makes the server slower and more dynamic for easier debugging. |
| 173 | # E.g., template files are reloaded on each request. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 174 | unit_test_mode = os.environ['SERVER_SOFTWARE'].startswith('test') |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 175 | local_mode = not (os.getenv('GAE_ENV') == 'standard' or unit_test_mode) |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 176 | |
Adrià Vilanova Martínez | 097a824 | 2024-01-26 21:20:10 +0100 | [diff] [blame] | 177 | # If we assume 1KB each, then this would be 10 MB for this cache in frontends |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 178 | # that have only 1024 MB total. |
Adrià Vilanova Martínez | 097a824 | 2024-01-26 21:20:10 +0100 | [diff] [blame] | 179 | issue_cache_max_size = 10 * 1000 |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 180 | |
Adrià Vilanova Martínez | 097a824 | 2024-01-26 21:20:10 +0100 | [diff] [blame] | 181 | # If we assume 1KB each, then this would be 10 MB for this cache in frontends |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 182 | # that have only 1024 MB total. |
Adrià Vilanova Martínez | 097a824 | 2024-01-26 21:20:10 +0100 | [diff] [blame] | 183 | comment_cache_max_size = 10 * 1000 |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 184 | |
Adrià Vilanova Martínez | 097a824 | 2024-01-26 21:20:10 +0100 | [diff] [blame] | 185 | user_cache_max_size = 10 * 1000 |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 186 | |
| 187 | # Normally we use the default namespace, but during development it is |
| 188 | # sometimes useful to run a tainted version on staging that has a separate |
| 189 | # memcache namespace. E.g., os.environ.get('CURRENT_VERSION_ID') |
| 190 | memcache_namespace = None # Should be None when committed. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 191 | |
| 192 | # Recompute derived issue fields via work items rather than while |
| 193 | # the user is waiting for a page to load. |
| 194 | recompute_derived_fields_in_worker = True |
| 195 | |
| 196 | # The issue search SQL queries have a LIMIT clause with this amount. |
| 197 | search_limit_per_shard = 10 * 1000 # This is more than all open in chromium. |
| 198 | |
| 199 | # The GAE search feature is slow, so don't request too many results. |
| 200 | # This limit is approximately the most results that we can get from |
| 201 | # the fulltext engine in 1s. If we reach this limit in any shard, |
| 202 | # the user will see a message explaining that results were capped. |
| 203 | fulltext_limit_per_shard = 1 * 2000 |
| 204 | |
| 205 | # Retrieve at most this many issues from the DB when showing an issue grid. |
| 206 | max_issues_in_grid = 6000 |
| 207 | # This is the most tiles that we show in grid view. If the number of results |
| 208 | # is larger than this, we display IDs instead. |
| 209 | max_tiles_in_grid = 1000 |
| 210 | |
| 211 | # Maximum number of project results to display on a single pagination page |
| 212 | max_project_search_results_per_page = 100 |
| 213 | |
| 214 | # Maximum number of results per pagination page, regardless of what |
| 215 | # the user specified in their request. This exists to prevent someone |
| 216 | # from doing a DoS attack that makes our servers do a huge amount of work. |
| 217 | max_artifact_search_results_per_page = 1000 |
| 218 | |
| 219 | # Maximum number of comments to display on a single pagination page |
| 220 | max_comments_per_page = 500 |
| 221 | |
| 222 | # Max number of issue starrers to notify via email. Issues with more |
| 223 | # that this many starrers will only notify the last N of them after a |
| 224 | # comment from a project member. |
| 225 | max_starrers_to_notify = 4000 |
| 226 | |
| 227 | # In projects that have more than this many issues the next and prev |
| 228 | # links on the issue detail page will not be shown when the user comes |
| 229 | # directly to an issue without specifying any query terms. |
| 230 | threshold_to_suppress_prev_next = 10000 |
| 231 | |
| 232 | # Format string for the name of the FTS index shards for issues. |
| 233 | search_index_name_format = 'issues%02d' |
| 234 | |
| 235 | # Name of the FTS index for projects (not sharded). |
| 236 | project_search_index_name = 'projects' |
| 237 | |
| 238 | # Each backend has this many seconds to respond, otherwise frontend gives up |
| 239 | # on that shard. |
| 240 | backend_deadline = 45 |
| 241 | |
| 242 | # If the initial call to a backend fails, try again this many times. |
| 243 | # Initial backend calls are failfast, meaning that they fail immediately rather |
| 244 | # than queue behind other requests. The last 2 retries will wait in queue. |
| 245 | backend_retries = 3 |
| 246 | |
| 247 | # Do various extra logging at INFO level. |
| 248 | enable_profiler_logging = True |
| 249 | |
| 250 | # Mail sending domain. Normally set this to None and it will be computed |
| 251 | # automatically from your AppEngine APP_ID. But, it can be overridden below. |
| 252 | mail_domain = None |
| 253 | |
| 254 | # URL format to browse source code revisions. This can be overridden |
| 255 | # in specific projects by setting project.revision_url_format. |
| 256 | # The format string may include "{revnum}" for the revision number. |
| 257 | revision_url_format = 'https://crrev.com/{revnum}' |
| 258 | |
| 259 | # Users with emails in the "priviledged" domains do NOT get any advantage |
| 260 | # but they do default their preference to show unobscured email addresses. |
| 261 | priviledged_user_domains = [ |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 262 | 'avm99963.com', |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 263 | ] |
| 264 | |
| 265 | # Branded domains: Any UI GET to a project listed below on prod or staging |
| 266 | # should have the specified host, otherwise it will be redirected such that |
| 267 | # the specified host is used. |
| 268 | branded_domains = {} # defaults to empty for localhost |
Adrià Vilanova Martínez | 097a824 | 2024-01-26 21:20:10 +0100 | [diff] [blame] | 269 | branded_domains_staging = {} # now staging is used for the local server |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 270 | branded_domains_prod = { |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 271 | '*': 'bugs.avm99963.com', |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | # The site home page will immediately redirect to a default project for these |
| 275 | # domains, if the project can be viewed. Structure is {hostport: project_name}. |
| 276 | domain_to_default_project = {} # defaults to empty for localhost |
Adrià Vilanova Martínez | 097a824 | 2024-01-26 21:20:10 +0100 | [diff] [blame] | 277 | domain_to_default_project_staging = {} # now staging is used for the local server |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 278 | domain_to_default_project_prod = {} |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 279 | |
| 280 | |
| 281 | # Names of projects on code.google.com which we allow cross-linking to. |
| 282 | recognized_codesite_projects = [ |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 283 | ] |
| 284 | |
| 285 | #### |
| 286 | # Part 5: Instance-specific settings that override lines above. |
| 287 | # This ID is for -staging and other misc deployments. Prod is defined below. |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 288 | |
| 289 | # IDs of the project for which label freezing should happen |
| 290 | label_freeze_project_ids = set() |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 291 | analytics_id = '' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 292 | |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 293 | # Project IDs which have opted into freezing project configs. |
| 294 | config_freeze_project_ids = set() |
| 295 | |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 296 | if unit_test_mode: |
| 297 | db_cloud_project = '' # No real database is used during unit testing. |
| 298 | app_id = '' |
| 299 | else: |
| 300 | app_id = app_identity.get_application_id() |
| 301 | |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 302 | if app_id == 'avm99963-bugs': |
| 303 | send_all_email_to = None # Deliver it to the intended users. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 304 | # The Google Cloud SQL databases to use. |
| 305 | db_cloud_project = app_id |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 306 | analytics_id = '' |
| 307 | branded_domains = branded_domains_prod |
| 308 | domain_to_default_project = domain_to_default_project_prod |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame] | 309 | |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 310 | label_freeze_project_ids = {} |
| 311 | config_freeze_project_ids = {} |
| 312 | config_freeze_override_users = {} |
| 313 | |
Adrià Vilanova Martínez | cab9d51 | 2021-07-10 01:50:12 +0200 | [diff] [blame] | 314 | elif app_id == 'monorail-staging': |
| 315 | site_name = 'Monorail Staging' |
| 316 | banner_message = 'This staging site does not send emails.' |
| 317 | # The Google Cloud SQL databases to use. |
| 318 | db_cloud_project = app_id |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame] | 319 | branded_domains = branded_domains_staging |
| 320 | domain_to_default_project = domain_to_default_project_staging |
Adrià Vilanova Martínez | cab9d51 | 2021-07-10 01:50:12 +0200 | [diff] [blame] | 321 | |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 322 | label_freeze_project_ids = {16} |
| 323 | config_freeze_project_ids = {16} |
| 324 | config_freeze_override_users = { |
| 325 | 16: |
| 326 | { |
| 327 | 'benhenry@google.com', 'zhangtiff@google.com', |
| 328 | 'summermcdonald@google.com', 'example@example.com' |
| 329 | } |
| 330 | } |
| 331 | |
Adrià Vilanova Martínez | cab9d51 | 2021-07-10 01:50:12 +0200 | [diff] [blame] | 332 | elif app_id == 'monorail-dev': |
| 333 | site_name = 'Monorail Dev' |
| 334 | banner_message = 'This dev site does not send emails.' |
| 335 | # The Google Cloud SQL databases to use. |
| 336 | db_cloud_project = app_id |
| 337 | branded_domains = branded_domains |
| 338 | domain_to_default_project = domain_to_default_project |
Adrià Vilanova Martínez | cab9d51 | 2021-07-10 01:50:12 +0200 | [diff] [blame] | 339 | # Use replicas created when testing the restore procedures on 2021-02-24 |
| 340 | db_replica_prefix = 'replica-2' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 341 | |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 342 | label_freeze_project_ids = {16, 36} |
| 343 | config_freeze_project_ids = {16, 36} |
| 344 | config_freeze_override_users = { |
| 345 | 16: |
| 346 | { |
| 347 | 'benhenry@google.com', 'zhangtiff@google.com', |
| 348 | 'summermcdonald@google.com', 'example@example.com' |
| 349 | }, |
| 350 | 36: {'viccontreras@google.com', 'nmulcahey@google.com'} |
| 351 | } |
| 352 | |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 353 | if local_mode: |
| 354 | site_name = 'Monorail Local' |
| 355 | num_logical_shards = 10 |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 356 | # Run cloud tasks emulator at port 9090 |
| 357 | CLOUD_TASKS_EMULATOR_ADDRESS = '127.0.0.1:9090' |
Adrià Vilanova Martínez | cab9d51 | 2021-07-10 01:50:12 +0200 | [diff] [blame] | 358 | CLOUD_TASKS_REGION = 'us-central1' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 359 | |
| 360 | # Combine the customized info above to make the name of the primary DB instance. |
| 361 | db_instance = db_cloud_project + ':' + db_region + ':' + db_primary_name |
| 362 | |
| 363 | # Combine the customized info above to make the names of the replica DB |
| 364 | # instances. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 365 | db_replica_names = [db_primary_name for i in range(num_logical_shards)] |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 366 | |
| 367 | # Format string for the name of the physical database replicas. |
| 368 | physical_db_name_format = (db_cloud_project + ':' + db_region + ':%s') |
| 369 | |
| 370 | # preferred domains to display |
| 371 | preferred_domains = { |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 372 | 'avm99963-bugs.appspot.com': 'bugs.avm99963.com'} |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 373 | |
| 374 | # Borg robot service account |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 375 | borg_service_account = 'chrome-infra-prod-borg-NOTUSEDBYAVM99963BUGS@system.gserviceaccount.com' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 376 | |
| 377 | # Prediction API params. |
| 378 | classifier_project_id = 'project-id-testing-only' |
| 379 | |
| 380 | # Necessary for tests. |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 381 | if six.PY2 and 'APPLICATION_ID' not in os.environ: |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 382 | os.environ['APPLICATION_ID'] = 'testing-app' |
| 383 | |
| 384 | if local_mode: |
| 385 | # There is no local stub for ML Engine. |
| 386 | classifier_project_id = 'monorail-staging' |
| 387 | else: |
| 388 | classifier_project_id = app_identity.get_application_id() |
| 389 | |
| 390 | classifier_model_id = '20170302' |
| 391 | |
| 392 | # Number of distinct users who have to flag an issue before it |
| 393 | # is automatically removed as spam. |
| 394 | # Currently effectively disabled. |
| 395 | spam_flag_thresh = 1000 |
| 396 | |
| 397 | # If the classifier's confidence is less than this value, the |
| 398 | # item will show up in the spam moderation queue for manual |
| 399 | # review. |
| 400 | classifier_moderation_thresh = 1.0 |
| 401 | |
| 402 | # If the classifier's confidence is greater than this value, |
| 403 | # and the label is 'spam', the item will automatically be created |
| 404 | # with is_spam=True, and will be filtered out from search results. |
| 405 | classifier_spam_thresh = 0.995 |
| 406 | |
| 407 | # Users with email addresses ending with these will not be subject to |
| 408 | # spam filtering. |
| 409 | spam_allowlisted_suffixes = ( |
| 410 | '@chromium.org', |
| 411 | '.gserviceaccount.com', |
| 412 | '@google.com', |
| 413 | '@webrtc.org', |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 414 | '@avm99963.com', |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 415 | ) |
| 416 | |
| 417 | # New issues filed by these users in these groups |
| 418 | # automatically get the Restrict-View-Google label. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 419 | restrict_new_issues_user_groups = [] |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 420 | |
| 421 | # Users in these groups see a "corp mode" warning dialog when commenting |
| 422 | # on public issues, informing them that their comments are public by default. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 423 | public_issue_notice_user_groups = [] |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 424 | |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 425 | full_emails_perm_groups = [] |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 426 | |
| 427 | # These email suffixes are allowed to create new alert bugs via email. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 428 | alert_allowlisted_suffixes = ('@avm99963.com',) |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 429 | |
| 430 | # The person who is notified if there is an unexpected problem in the alert |
| 431 | # pipeline. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 432 | alert_escalation_email = 'me@avm99963.com' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 433 | |
| 434 | # Bugs autogenerated from alert emails are created through this account. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 435 | alert_service_account = 'autogenerated-bug-from-alert-mails-monorail@noreply.avm99963.com' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 436 | |
| 437 | # The number of hash buckets to use when vectorizing text from Issues and |
| 438 | # Comments. This should be the same value that the model was trained with. |
| 439 | spam_feature_hashes = 500 |
| 440 | |
| 441 | # The number of features to use when vectorizing text from Issues and |
| 442 | # Comments. This should be the same value that the model was trained with. |
| 443 | component_features = 5000 |
| 444 | |
| 445 | # The name of the spam model in ML Engine. |
| 446 | spam_model_name = 'spam_only_words' |
| 447 | |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 448 | ratelimiting_enabled = True |
| 449 | |
| 450 | # Requests that hit ratelimiting_cost_thresh_sec get one extra count |
| 451 | # added to their bucket at the end of the request for each additional |
| 452 | # multiple of this latency. |
| 453 | ratelimiting_ms_per_count = 1000 |
| 454 | |
| 455 | api_ratelimiting_enabled = True |
| 456 | |
| 457 | # When we post an auto-ping comment, it is posted by this user @ the preferred |
| 458 | # domain name. E.g., 'monorail@bugs.chromium.org'. |
| 459 | date_action_ping_author = 'monorail' |
| 460 | |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 461 | # Hard-coding this so that we don't rely on sys.maxsize, which could |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 462 | # potentially differ. It is equal to the maximum unsigned 32 bit integer, |
| 463 | # because the `int(10) unsigned` column type in MySQL is 32 bits. |
| 464 | maximum_snapshot_period_end = 4294967295 |
| 465 | |
| 466 | # The maximum number of rows chart queries can scan. |
| 467 | chart_query_max_rows = 10000 |
| 468 | |
| 469 | # Client ID to use for loading the Google API client, gapi.js. |
Adrià Vilanova Martínez | 515639b | 2021-07-06 16:43:59 +0200 | [diff] [blame] | 470 | # (This is not used by avm99963 bugs, this is only useful for buganizer bugs) |
| 471 | gapi_client_id = '' |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 472 | |
| 473 | # The pub/sub topic on which to publish issue update messages. |
| 474 | if local_mode: |
| 475 | # In local dev, send issue updates to the monorail-dev project. |
| 476 | # There also exists a pubsub emulator we could potentially use in the future: |
| 477 | # https://cloud.google.com/pubsub/docs/emulator |
| 478 | pubsub_project = 'monorail-dev' |
| 479 | else: |
| 480 | pubsub_project = app_identity.get_application_id() |
| 481 | |
| 482 | pubsub_topic_id = 'projects/%s/topics/issue-updates' % pubsub_project |
| 483 | |
| 484 | # All users in the following domains will have API access. |
| 485 | # Important: the @ symbol must be included. |
Adrià Vilanova Martínez | 96deb38 | 2021-08-08 00:13:47 +0200 | [diff] [blame] | 486 | api_allowed_email_domains = ('@avm99963.com', '@avm99963-bugs.iam.gserviceaccount.com') |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 487 | |
| 488 | label_prefix_allowlist = [ |
| 489 | 'CVE-', |
| 490 | 'reward_to-', |
| 491 | 'merge-merge-', |
| 492 | 'migrated-to-b-', |
| 493 | 'copybara-migration-complete-', |
| 494 | 'cob-migrated-to-b-', |
| 495 | 'incident-id-', |
| 496 | 'version-', |
| 497 | 'copybara-migrate-c-', |
| 498 | 'reward-', |
| 499 | 'b-', |
| 500 | ] |
| 501 | |
| 502 | |
| 503 | def is_label_allowed(project_id, label): |
| 504 | # Only allowlist label prefixes for 'Chromium' project. |
| 505 | if project_id == 16: |
| 506 | return any(label.startswith(prefix) for prefix in label_prefix_allowlist) |
| 507 | |
| 508 | |
| 509 | # This list should stay in sync with MIGRATED_BUGANIZER_ISSUE_PREFIXES in |
| 510 | # `appengine/monorail/static_src/reducers/issueV0.js`. |
| 511 | migrated_buganizer_issue_prefixes = [ |
| 512 | 'migrated-to-b-', |
| 513 | 'copybara-migration-complete-', |
| 514 | 'cob-migrated-to-b-', |
| 515 | ] |