From 18d6289807527eb9bb2c291ac4e2a21d3e0f1f23 Mon Sep 17 00:00:00 2001 From: nessi Date: Fri, 13 Feb 2026 09:07:10 +0100 Subject: [PATCH] Remove configurable APP_VERSION and define it in code The APP_VERSION variable is no longer configurable via the `.env` file or environment settings. Instead, the version is now hardcoded in `backend/app/core/config.py` as `NEXAPG_VERSION` and accessed through a property. This change simplifies version control and ensures consistency across deployments. --- .env.example | 2 -- README.md | 2 +- backend/app/core/config.py | 7 ++++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 8c1d178..802baf1 100644 --- a/.env.example +++ b/.env.example @@ -3,8 +3,6 @@ # ------------------------------ # Display name used in API docs/UI. APP_NAME=NexaPG Monitor -# Manual version string shown in Service Information page. -APP_VERSION=0.1.0 # Runtime environment: dev | staging | prod | test ENVIRONMENT=dev # Backend log level: DEBUG | INFO | WARNING | ERROR diff --git a/README.md b/README.md index 7292bf8..6670faf 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,6 @@ Note: Migrations run automatically when the backend container starts (`entrypoin | Variable | Description | |---|---| | `APP_NAME` | Application display name | -| `APP_VERSION` | Displayed NexaPG version in Service Information | | `ENVIRONMENT` | Runtime environment (`dev`, `staging`, `prod`, `test`) | | `LOG_LEVEL` | Backend log level (`DEBUG`, `INFO`, `WARNING`, `ERROR`) | @@ -238,6 +237,7 @@ Recommended values for `VITE_API_URL`: - Displays current version, latest known version, uptime, host, and platform - "Check for Updates" against the latest published release in the official upstream repository (`git.nesterovic.cc/nessi/NexaPG`) - Version/update source are read-only in UI (maintainer-controlled in code/release flow) +- Local displayed version is code-defined in `backend/app/core/config.py` (`NEXAPG_VERSION`) and not configurable via `.env` ## Target Owner Notifications diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 6c1c2bd..57e643c 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -2,12 +2,13 @@ from functools import lru_cache from pydantic import field_validator from pydantic_settings import BaseSettings, SettingsConfigDict +NEXAPG_VERSION = "0.1.1" + class Settings(BaseSettings): model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore") app_name: str = "NexaPG Monitor" - app_version: str = "0.1.0" environment: str = "dev" api_v1_prefix: str = "/api/v1" log_level: str = "INFO" @@ -33,6 +34,10 @@ class Settings(BaseSettings): init_admin_email: str = "admin@example.com" init_admin_password: str = "ChangeMe123!" + @property + def app_version(self) -> str: + return NEXAPG_VERSION + @property def database_url(self) -> str: return (