Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add status and version endpoints #14

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading