|
69 | 69 | f"{DISCOURSE_PATH}/log/unicorn.stderr.log",
|
70 | 70 | f"{DISCOURSE_PATH}/log/unicorn.stdout.log",
|
71 | 71 | ]
|
| 72 | +MAX_CATEGORY_NESTING_LEVELS = [2, 3] |
72 | 73 | PROMETHEUS_PORT = 3000
|
73 | 74 | REQUIRED_S3_SETTINGS = ["s3_access_key_id", "s3_bucket", "s3_region", "s3_secret_access_key"]
|
74 | 75 | SCRIPT_PATH = "/srv/scripts"
|
@@ -311,7 +312,11 @@ def _is_config_valid(self) -> bool:
|
311 | 312 | and self.model.get_relation(DEFAULT_RELATION_NAME) is None
|
312 | 313 | ):
|
313 | 314 | errors.append("force_saml_login cannot be true without a saml relation")
|
314 |
| - |
| 315 | + if self.config["max_category_nesting"] not in MAX_CATEGORY_NESTING_LEVELS: |
| 316 | + errors.append( |
| 317 | + "max_category_nesting must be one of: " |
| 318 | + f"{', '.join(map(str, MAX_CATEGORY_NESTING_LEVELS))}" |
| 319 | + ) |
315 | 320 | if (
|
316 | 321 | self.config["saml_sync_groups"]
|
317 | 322 | and self.model.get_relation(DEFAULT_RELATION_NAME) is None
|
@@ -465,6 +470,7 @@ def _create_discourse_environment_settings(self) -> typing.Dict[str, str]:
|
465 | 470 | "DISCOURSE_DEVELOPER_EMAILS": self.config["developer_emails"],
|
466 | 471 | "DISCOURSE_ENABLE_CORS": str(self.config["enable_cors"]).lower(),
|
467 | 472 | "DISCOURSE_HOSTNAME": self._get_external_hostname(),
|
| 473 | + "DISCOURSE_MAX_CATEGORY_NESTING": str(self.config["max_category_nesting"]), |
468 | 474 | "DISCOURSE_REDIS_HOST": redis_relation_data[0],
|
469 | 475 | "DISCOURSE_REDIS_PORT": str(redis_relation_data[1]),
|
470 | 476 | "DISCOURSE_REFRESH_MAXMIND_DB_DURING_PRECOMPILE_DAYS": "0",
|
|
0 commit comments