Skip to content

Commit f3f7360

Browse files
Backend: Strongly type the config object
1 parent d383262 commit f3f7360

46 files changed

Lines changed: 457 additions & 465 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/backend/src/app.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ def log_unhandled_exception(
5151
def common_init() -> None:
5252
sys.excepthook = log_unhandled_exception
5353

54-
if config["SENTRY_ENABLED"]:
54+
if config.sentry_enabled:
5555
# Sends exception tracebacks to Sentry, a cloud service for collecting exceptions
5656
sentry_sdk.init(
57-
config["SENTRY_URL"],
57+
config.sentry_url,
5858
traces_sample_rate=0.0,
59-
environment=config["COOKIE_DOMAIN"],
60-
release=config["VERSION"],
59+
environment=config.cookie_domain,
60+
release=config.version,
6161
# The global excepthook picks up already handled gRPC errors (e.g. grpc.StatusCode.NOT_FOUND)
6262
disabled_integrations=[
6363
excepthook.ExcepthookIntegration(),
@@ -81,16 +81,16 @@ def main() -> None:
8181

8282
get_main_i18next() # Force eager loading of translations
8383

84-
if config["ADD_DUMMY_DATA"]:
84+
if config.add_dummy_data:
8585
add_dummy_data()
8686

8787
logger.info("Starting")
8888

89-
if config["ROLE"] in ["scheduler", "all"]:
89+
if config.role in ["scheduler", "all"]:
9090
start_jobs_scheduler()
9191

92-
if config["ROLE"] in ["worker", "all"]:
93-
for _ in range(config["BACKGROUND_WORKER_COUNT"]):
92+
if config.role in ["worker", "all"]:
93+
for _ in range(config.background_worker_count):
9494
start_jobs_worker()
9595

9696
setup_tracing()
@@ -101,7 +101,7 @@ def main() -> None:
101101
# Worker processes initialize their own instance in _run_forever().
102102
setup_experimentation()
103103

104-
if config["ROLE"] in ["api", "all"]:
104+
if config.role in ["api", "all"]:
105105
server = create_main_server(port=1751)
106106
server.start()
107107
media_server = create_media_server(port=1753)

0 commit comments

Comments
 (0)