Skip to content

Commit

Permalink
Add DEPLOYMENT_ENVIRONMENT env var to runtime info (#8)
Browse files Browse the repository at this point in the history
This PR exposes the DEPLOYMENT_ENVIRONMENT variable in the runtime info.
This is accessible via `GET /runtime-info`.
  • Loading branch information
ben-z authored Sep 23, 2024
1 parent 922b42e commit 65b3ee7
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,22 @@ def healthcheck(app: WATcloudFastAPI):
scheduler.start()
table_client = get_azure_table_client("signups", create_table_if_not_exists=True)
directory_service = DirectoryService(logger=logger)
initial_runtime_info = {
"num_signups": 0,
"num_successful_confirms": 0,
"num_failed_confirms": 0,
"num_expired_signups": 0,
"num_successful_commits": 0,
"last_cleanup_time": time.time(),
"last_commit_time": time.time(),
}
if os.environ.get("DEPLOYMENT_ENVIRONMENT"):
initial_runtime_info["deployment_environment"] = os.environ["DEPLOYMENT_ENVIRONMENT"]

app = WATcloudFastAPI(
logger=logger,
lifespan=lifespan,
initial_runtime_info={
"num_signups": 0,
"num_successful_confirms": 0,
"num_failed_confirms": 0,
"num_expired_signups": 0,
"num_successful_commits": 0,
"last_cleanup_time": time.time(),
"last_commit_time": time.time(),
},
initial_runtime_info=initial_runtime_info,
health_fns=[healthcheck],
)

Expand Down

0 comments on commit 65b3ee7

Please sign in to comment.