Loading version code env var into web server app

This commit is contained in:
DarkCat09 2023-03-24 20:10:05 +04:00
parent ea855dc311
commit 4eb0203b2d
3 changed files with 5 additions and 0 deletions

View file

@ -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

View file

@ -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

View file

@ -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'