Skip to content

Commit

Permalink
Merge pull request #14 from hcholab/status-endpoints
Browse files Browse the repository at this point in the history
add status and version endpoints
  • Loading branch information
simonjmendelsohn authored Nov 30, 2023
2 parents 2c9b6b3 + e236016 commit 4d95949
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from quart_cors import cors
from google.cloud import firestore

from src import cli, signaling
from src import cli, signaling, status
from src.utils import custom_logging
from src.web import web, participants, study

Expand All @@ -23,6 +23,7 @@ def create_app() -> Quart:
SECRET_KEY=secrets.token_hex(16), DATABASE=firestore.AsyncClient()
)

app.register_blueprint(status.bp)
app.register_blueprint(cli.bp)
app.register_blueprint(web.bp)
app.register_blueprint(participants.bp)
Expand Down
15 changes: 15 additions & 0 deletions src/status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from typing import Tuple
from quart import Blueprint

from src.utils import constants


bp = Blueprint("status", __name__, url_prefix="")

@bp.route("/status", methods=["GET"])
async def status() -> Tuple[dict, int]:
return {}, 200

@bp.route("/version", methods=["GET"])
async def version() -> Tuple[dict, int]:
return {"appVersion": constants.APP_VERSION, "buildVersion": constants.BUILD_VERSION}, 200
3 changes: 3 additions & 0 deletions src/utils/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from copy import deepcopy
import os

APP_VERSION = os.getenv('APP_VERSION', '')
BUILD_VERSION = os.getenv('BUILD_VERSION', '')
SERVER_GCP_PROJECT = "broad-cho-priv1"
SERVER_REGION = "us-central1"
SERVER_ZONE = f"{SERVER_REGION}-a"
Expand Down

0 comments on commit 4d95949

Please sign in to comment.