Coverage for webapp/config.py: 100%
11 statements
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-18 22:11 +0000
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-18 22:11 +0000
1import os
2from canonicalwebteam.flask_base.env import load_plain_env_variables
5# Load the prefixed FLASK_* env vars into env vars without the prefix. We have
6# to do this explicitly here because otherwise the config module is imported
7# by other files before the FlaskBase app gets initialized and does this by
8# itself, meaning that the variables below are not set correctly
9load_plain_env_variables()
11APP_NAME = "charmhub"
12DETAILS_VIEW_REGEX = "[A-Za-z0-9-]*[A-Za-z][A-Za-z0-9-]*"
14CATEGORIES = [
15 {"slug": "ai-ml", "name": "AI/ML"},
16 {"slug": "big-data", "name": "Big data"},
17 {"slug": "cloud", "name": "Cloud"},
18 {"slug": "containers", "name": "Containers"},
19 {"slug": "databases", "name": "Databases"},
20 {"slug": "logging-tracing", "name": "Logging and tracing"},
21 {"slug": "monitoring", "name": "Monitoring"},
22 {"slug": "networking", "name": "Networking"},
23 {"slug": "security", "name": "Security"},
24 {"slug": "storage", "name": "Storage"},
25]
27SEARCH_FIELDS = [
28 "result.categories",
29 "result.summary",
30 "result.media",
31 "result.title",
32 "result.publisher.display-name",
33 "result.deployable-on",
34]
36SENTRY_DSN = os.getenv("SENTRY_DSN", "").strip()
37STATUS_BANNER = os.getenv("STATUS_BANNER", "").strip()
39# Vite integration config values
40IS_DEVELOPMENT = os.getenv("ENVIRONMENT", "devel") == "devel"
42VITE_CONFIG = {
43 "VITE_MODE": "development" if IS_DEVELOPMENT else "production",
44 "VITE_PORT": os.getenv("VITE_PORT", 5173),
45 "VITE_OUTDIR": os.getenv("VITE_OUTDIR", "static/js/dist/vite"),
46 # VITE_REACT controls whether React hot module reload scripts are injected
47 # when running in dev mode; the setting has no effect in prod mode
48 "VITE_REACT": True,
49}