Add VERSION file and live version display on settings page
- New VERSION file at project root, starting at 0.3.0. - config.py reads VERSION and exposes it as Config.VERSION. - Admin settings page now renders the live version from config. - Semantic versioning convention: MAJOR for breaking/user-facing changes, MINOR for new features, PATCH for bug fixes and small polish.
This commit is contained in:
parent
d9e198e397
commit
db249e80bd
4 changed files with 16 additions and 1 deletions
1
VERSION
Normal file
1
VERSION
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
0.3.0
|
||||||
1
app.py
1
app.py
|
|
@ -1444,6 +1444,7 @@ def admin_settings():
|
||||||
hermes_key_masked=hermes_key_masked,
|
hermes_key_masked=hermes_key_masked,
|
||||||
hermes_key_set=hermes_key_set,
|
hermes_key_set=hermes_key_set,
|
||||||
hermes_key_just_generated=hermes_key_just_generated,
|
hermes_key_just_generated=hermes_key_just_generated,
|
||||||
|
version=current_app.config['VERSION'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
13
config.py
13
config.py
|
|
@ -32,10 +32,20 @@ Environment variables (defaults shown):
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
# Load variables from .env file if present (development mode).
|
# Load variables from .env file if present (development mode).
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
|
||||||
|
def _load_version():
|
||||||
|
"""Read the package version from the VERSION file next to this module."""
|
||||||
|
version_file = Path(__file__).parent / 'VERSION'
|
||||||
|
if version_file.exists():
|
||||||
|
return version_file.read_text().strip()
|
||||||
|
return '0.0.0'
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
# Flask secret key: used to sign session cookies and encrypt stored credentials.
|
# Flask secret key: used to sign session cookies and encrypt stored credentials.
|
||||||
SECRET_KEY = os.environ.get('APP_SECRET_KEY', 'dev-secret-change-me')
|
SECRET_KEY = os.environ.get('APP_SECRET_KEY', 'dev-secret-change-me')
|
||||||
|
|
@ -82,3 +92,6 @@ class Config:
|
||||||
# Informational price shown to the operator/customer; actual payment is collected manually (e.g. Square).
|
# Informational price shown to the operator/customer; actual payment is collected manually (e.g. Square).
|
||||||
PRICE_PER_VERSION = float(os.environ.get('PRICE_PER_VERSION', '10.00'))
|
PRICE_PER_VERSION = float(os.environ.get('PRICE_PER_VERSION', '10.00'))
|
||||||
CURRENCY = os.environ.get('CURRENCY', 'CAD')
|
CURRENCY = os.environ.get('CURRENCY', 'CAD')
|
||||||
|
|
||||||
|
# Package version, read from VERSION file.
|
||||||
|
VERSION = _load_version()
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="topbar">
|
<div class="topbar">
|
||||||
<h1>Admin Settings <span class="version-tag">v0.3</span></h1>
|
<h1>Admin Settings <span class="version-tag">v{{ version }}</span></h1>
|
||||||
<div class="nav">
|
<div class="nav">
|
||||||
<a href="{{ url_for('admin_dashboard') }}">← Back to Dashboard</a>
|
<a href="{{ url_for('admin_dashboard') }}">← Back to Dashboard</a>
|
||||||
<a href="{{ url_for('admin_logout') }}">Log out</a>
|
<a href="{{ url_for('admin_logout') }}">Log out</a>
|
||||||
|
|
|
||||||
Reference in a new issue