From 4eb0203b2dd698862fccde0a4606d02eb33d9d93 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 24 Mar 2023 20:10:05 +0400 Subject: [PATCH] Loading version code env var into web server app --- Makefile | 2 ++ README.md | 2 ++ app/common.py | 1 + 3 files changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 7360c39..dcf82fa 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,12 @@ APP_HOST ?= 0.0.0.0 APP_PORT ?= 8000 dev: + python3 -m dotenv -f version_code run \ python3 -m dotenv -f .env_debug run \ make cmd-dev prod: + python3 -m dotenv -f version_code run \ python3 -m gunicorn \ -w 4 -k uvicorn.workers.UvicornWorker \ -b $${APP_HOST}:$${APP_PORT} main:app diff --git a/README.md b/README.md index 9055a60..a903075 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,8 @@ Make commands: loaded only in docker-compose by default - `.env_db` is a config for MySQL/MariaDB server, also loaded only in docker-compose for the mariadb container + - `version` contains only one variable, your application version code; + change it whatever you want or leave `1.0.0` #### The main config loaded by `app/common.py`: - `templates_dir`, `static_dir` contain the paths to templates and static files directories correspondingly diff --git a/app/common.py b/app/common.py index e4c8af1..82cbffe 100644 --- a/app/common.py +++ b/app/common.py @@ -14,6 +14,7 @@ static_dir = str(file_dir.parent / 'static') # Main configuration class Settings(BaseSettings): + version: str = '1.0.0' debug: bool = False session_key: str = 'secret' csrf_key: str = 'secret'