Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 18d6289807 | |||
| e24681332d |
@@ -3,8 +3,6 @@
|
|||||||
# ------------------------------
|
# ------------------------------
|
||||||
# Display name used in API docs/UI.
|
# Display name used in API docs/UI.
|
||||||
APP_NAME=NexaPG Monitor
|
APP_NAME=NexaPG Monitor
|
||||||
# Manual version string shown in Service Information page.
|
|
||||||
APP_VERSION=0.1.0
|
|
||||||
# Runtime environment: dev | staging | prod | test
|
# Runtime environment: dev | staging | prod | test
|
||||||
ENVIRONMENT=dev
|
ENVIRONMENT=dev
|
||||||
# Backend log level: DEBUG | INFO | WARNING | ERROR
|
# Backend log level: DEBUG | INFO | WARNING | ERROR
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ Note: Migrations run automatically when the backend container starts (`entrypoin
|
|||||||
| Variable | Description |
|
| Variable | Description |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `APP_NAME` | Application display name |
|
| `APP_NAME` | Application display name |
|
||||||
| `APP_VERSION` | Displayed NexaPG version in Service Information |
|
|
||||||
| `ENVIRONMENT` | Runtime environment (`dev`, `staging`, `prod`, `test`) |
|
| `ENVIRONMENT` | Runtime environment (`dev`, `staging`, `prod`, `test`) |
|
||||||
| `LOG_LEVEL` | Backend log level (`DEBUG`, `INFO`, `WARNING`, `ERROR`) |
|
| `LOG_LEVEL` | Backend log level (`DEBUG`, `INFO`, `WARNING`, `ERROR`) |
|
||||||
|
|
||||||
@@ -236,8 +235,9 @@ Recommended values for `VITE_API_URL`:
|
|||||||
|
|
||||||
- Sidebar entry for runtime and system details
|
- Sidebar entry for runtime and system details
|
||||||
- Displays current version, latest known version, uptime, host, and platform
|
- Displays current version, latest known version, uptime, host, and platform
|
||||||
- "Check for Updates" against the official upstream repository (`git.nesterovic.cc/nessi/NexaPG`)
|
- "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)
|
- 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
|
## Target Owner Notifications
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ from functools import lru_cache
|
|||||||
from pydantic import field_validator
|
from pydantic import field_validator
|
||||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||||
|
|
||||||
|
NEXAPG_VERSION = "0.1.1"
|
||||||
|
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
||||||
|
|
||||||
app_name: str = "NexaPG Monitor"
|
app_name: str = "NexaPG Monitor"
|
||||||
app_version: str = "0.1.0"
|
|
||||||
environment: str = "dev"
|
environment: str = "dev"
|
||||||
api_v1_prefix: str = "/api/v1"
|
api_v1_prefix: str = "/api/v1"
|
||||||
log_level: str = "INFO"
|
log_level: str = "INFO"
|
||||||
@@ -33,6 +34,10 @@ class Settings(BaseSettings):
|
|||||||
init_admin_email: str = "admin@example.com"
|
init_admin_email: str = "admin@example.com"
|
||||||
init_admin_password: str = "ChangeMe123!"
|
init_admin_password: str = "ChangeMe123!"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def app_version(self) -> str:
|
||||||
|
return NEXAPG_VERSION
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def database_url(self) -> str:
|
def database_url(self) -> str:
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ def _get_json(url: str):
|
|||||||
|
|
||||||
def _fetch_latest_from_upstream_sync() -> tuple[str, str]:
|
def _fetch_latest_from_upstream_sync() -> tuple[str, str]:
|
||||||
latest_release_url = f"{UPSTREAM_REPO_API}/releases/latest"
|
latest_release_url = f"{UPSTREAM_REPO_API}/releases/latest"
|
||||||
tags_url = f"{UPSTREAM_REPO_API}/tags?page=1&limit=1"
|
|
||||||
commits_url = f"{UPSTREAM_REPO_API}/commits?sha=main&page=1&limit=1"
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
release = _get_json(latest_release_url)
|
release = _get_json(latest_release_url)
|
||||||
@@ -74,27 +72,9 @@ def _fetch_latest_from_upstream_sync() -> tuple[str, str]:
|
|||||||
tag = (release.get("tag_name") or release.get("name") or "").strip()
|
tag = (release.get("tag_name") or release.get("name") or "").strip()
|
||||||
if tag:
|
if tag:
|
||||||
return tag[:64], "release"
|
return tag[:64], "release"
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
pass
|
raise ValueError(f"Could not fetch latest release from upstream repository: {exc}") from exc
|
||||||
|
raise ValueError("No published release found in upstream repository")
|
||||||
try:
|
|
||||||
tags = _get_json(tags_url)
|
|
||||||
if isinstance(tags, list) and tags:
|
|
||||||
first = tags[0] if isinstance(tags[0], dict) else {}
|
|
||||||
tag = (first.get("name") or "").strip()
|
|
||||||
if tag:
|
|
||||||
return tag[:64], "tag"
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
commits = _get_json(commits_url)
|
|
||||||
if isinstance(commits, list) and commits:
|
|
||||||
first = commits[0] if isinstance(commits[0], dict) else {}
|
|
||||||
sha = (first.get("sha") or "").strip()
|
|
||||||
if sha:
|
|
||||||
short = sha[:7]
|
|
||||||
return f"commit-{short}", "commit"
|
|
||||||
raise ValueError("Could not fetch release/tag/commit from upstream repository")
|
|
||||||
|
|
||||||
|
|
||||||
async def fetch_latest_from_upstream() -> tuple[str | None, str | None, str | None]:
|
async def fetch_latest_from_upstream() -> tuple[str | None, str | None, str | None]:
|
||||||
|
|||||||
Reference in New Issue
Block a user