Versioning consistency and bump both the XPI and backend to version 0.2.0
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
## Copyright © 2026 Olaf Kolkman
|
||||
## SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, field
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
@@ -10,6 +11,7 @@ from cryptography.fernet import Fernet
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
DB_PATH = BASE_DIR / 'data' / 'linklog.db'
|
||||
VERSION_FILE = BASE_DIR.parent / 'frontend' / 'version.json'
|
||||
|
||||
|
||||
def normalize_public_url(value: str) -> str:
|
||||
@@ -20,11 +22,19 @@ def normalize_public_url(value: str) -> str:
|
||||
return f'{scheme}://{value}'
|
||||
|
||||
|
||||
def load_version() -> str:
|
||||
# frontend/version.json is the single source of truth for the app version, shared by backend and frontend.
|
||||
try:
|
||||
return json.loads(VERSION_FILE.read_text())['version']
|
||||
except (OSError, KeyError, ValueError):
|
||||
return '0.0.0'
|
||||
|
||||
|
||||
@dataclass
|
||||
class Settings:
|
||||
app_env: str = os.getenv('APP_ENV', 'development').lower()
|
||||
app_name: str = os.getenv('LINKLOG_APP_NAME', 'LinkLog')
|
||||
version: str = os.getenv('LINKLOG_VERSION', '0.1.1')
|
||||
version: str = field(default_factory=load_version)
|
||||
database_url: str = os.getenv('LINKLOG_DATABASE_URL', f'sqlite:///{DB_PATH}')
|
||||
secret_key: str = os.getenv('LINKLOG_SECRET_KEY', 'dev-secret-key-change-me')
|
||||
data_encryption_key: str = os.getenv('LINKLOG_DATA_ENCRYPTION_KEY', '')
|
||||
|
||||
Reference in New Issue
Block a user