diff --git a/app/__init__.py b/app/__init__.py index bc00524..78e2c39 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -7,7 +7,7 @@ import uuid from flask import Flask, Response, g, request -from app.config import config +from app.config import VERSION, config def setup_logging(app: Flask) -> None: @@ -176,7 +176,7 @@ def setup_metrics(app: Flask) -> None: metrics = PrometheusMetrics(app) # Add app info - metrics.info("flaskpaste_info", "FlaskPaste application info", version="1.0.0") + metrics.info("flaskpaste_info", "FlaskPaste application info", version=VERSION) app.extensions["metrics"] = metrics except ImportError: diff --git a/app/api/routes.py b/app/api/routes.py index c4ca379..5f1505b 100644 --- a/app/api/routes.py +++ b/app/api/routes.py @@ -11,6 +11,7 @@ import time from flask import Response, current_app, request from app.api import bp +from app.config import VERSION from app.database import check_content_hash, get_db # Valid paste ID pattern (hexadecimal only) @@ -275,7 +276,7 @@ def index(): return _json_response( { "name": "FlaskPaste", - "version": "1.0.0", + "version": VERSION, "endpoints": { "GET /": "API information", "GET /health": "Health check", diff --git a/app/config.py b/app/config.py index 4d7591d..94bf071 100644 --- a/app/config.py +++ b/app/config.py @@ -3,6 +3,9 @@ import os from pathlib import Path +# Application version +VERSION = "1.1.0" + class Config: """Base configuration.""" diff --git a/documentation/api.md b/documentation/api.md index 07ce694..da416fe 100644 --- a/documentation/api.md +++ b/documentation/api.md @@ -103,7 +103,7 @@ Host: localhost:5000 ```json { "name": "FlaskPaste", - "version": "1.0.0", + "version": "1.1.0", "endpoints": { "GET /": "API information", "GET /health": "Health check", diff --git a/tests/test_api.py b/tests/test_api.py index 5628d94..30c2179 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -2,6 +2,8 @@ import json +from app.config import VERSION + class TestIndex: """Tests for GET / endpoint.""" @@ -12,7 +14,7 @@ class TestIndex: assert response.status_code == 200 data = json.loads(response.data) assert data["name"] == "FlaskPaste" - assert data["version"] == "1.0.0" + assert data["version"] == VERSION assert "endpoints" in data assert "usage" in data