first commit

This commit is contained in:
2025-10-15 13:58:10 -05:00
commit 85d9214883
9 changed files with 300 additions and 0 deletions

24
app/blueprints/api.py Normal file
View File

@@ -0,0 +1,24 @@
import os
from flask import Blueprint, jsonify
from flask_httpauth import HTTPTokenAuth
from utils.token_store import ApiKeyStore
api_bp = Blueprint("api", __name__)
auth = HTTPTokenAuth(scheme="Bearer")
STORE_PATH = os.getenv("API_TOKEN_FILE", "data/api_tokens.yaml")
store = ApiKeyStore(STORE_PATH, bcrypt_rounds=12)
@auth.verify_token
def verify_token(token: str):
return store.verify(token)
@auth.error_handler
def auth_error(status):
return jsonify({"error": "Unauthorized"}), status
@api_bp.route("/health", methods=["GET"])
@auth.login_required
def health():
return jsonify({"healthy": True})

7
app/blueprints/main.py Normal file
View File

@@ -0,0 +1,7 @@
from flask import Blueprint, render_template
main_bp = Blueprint("main", __name__)
@main_bp.route("/")
def index():
return render_template("index.html")