From d59e8b7b93ebe00756a60fea4aeb2be0f737d378 Mon Sep 17 00:00:00 2001 From: sureshhewa Date: Mon, 5 Aug 2024 09:39:49 +0100 Subject: [PATCH] V2 dev pipeline --- .github/workflows/github-dev.yml | 1 + .github/workflows/github.yml | 1 + app/api.py | 3 ++- db_config_parser.py | 7 +++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/github-dev.yml b/.github/workflows/github-dev.yml index 96b64a0..e537823 100644 --- a/.github/workflows/github-dev.yml +++ b/.github/workflows/github-dev.yml @@ -59,6 +59,7 @@ jobs: DB_PASSWORD : ${{ secrets.DB_PASSWORD }} DB_PORT : ${{ vars.DB_PORT }} API_KEY : ${{ secrets.API_KEY }} + API_VERSION : ${{ vars.API_KEY }} PORT: ${{ vars.PORT }} node_port: ${{ vars.NODE_PORT }} app_name: ${{ vars.APP_NAME }} diff --git a/.github/workflows/github.yml b/.github/workflows/github.yml index b639915..ec54506 100644 --- a/.github/workflows/github.yml +++ b/.github/workflows/github.yml @@ -58,6 +58,7 @@ jobs: DB_PASSWORD : ${{ secrets.DB_PASSWORD }} DB_PORT : ${{ vars.DB_PORT }} API_KEY : ${{ secrets.API_KEY }} + API_VERSION : ${{ vars.API_KEY }} PORT: ${{ vars.PORT }} node_port: ${{ vars.NODE_PORT }} app_name: ${{ vars.APP_NAME }} diff --git a/app/api.py b/app/api.py index 708a858..7a10cc4 100644 --- a/app/api.py +++ b/app/api.py @@ -9,11 +9,12 @@ from app.routes.xiview import xiview_data_router from app.routes.parse import parser_router from fastapi.middleware.gzip import GZipMiddleware +from db_config_parser import API_version # Initialize logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) -API_VERSION = "v2" +API_VERSION = API_version() app = FastAPI(title="xi-mzidentml-converter ws", description="This is an API to crosslinking archive", diff --git a/db_config_parser.py b/db_config_parser.py index 656d19e..6ca2c36 100644 --- a/db_config_parser.py +++ b/db_config_parser.py @@ -38,6 +38,13 @@ def security_API_key(): return apikey +def API_version(): + config = os.environ.get('DB_CONFIG', 'database.ini') + security_info = parse_info(config, 'security') + apiversion = security_info.get("apiversion") + return apiversion + + def redis_config(): config = os.environ.get('DB_CONFIG', 'database.ini') redis_info = parse_info(config, 'redis')