Files
gitea-sync-ai/app/main.py
T

26 lines
808 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import os
from pathlib import Path
from fastapi import FastAPI, HTTPException, Request
from fastapi.responses import HTMLResponse
# Umgebungsvariablen mit Fallback
GITEE_URL = os.getenv("GITEE_URL", "https://git.carabella.ch/")
ACCESS_TOKEN = os.getenv("ACCESS_TOKEN", "") # Leerlassen, falls nicht gesetzt
COMMIT_NAME = os.getenv("COMMIT_NAME", "KI-Sparringpartner")
# Projekt-Ordner (gemountet im Docker)
PROJECTS_DIR = Path("/projects")
def get_token():
"""Gibt Token zurück aus .env oder leer."""
return ACCESS_TOKEN or ""
app = FastAPI(title="Gitea Sync AI", version="1.0")
# Frontend ausliefern
@app.get("/", response_class=HTMLResponse)
async def dashboard(request: Request):
with open("/home/user/projects/gitea-cloner/app/templates/index.html") as f:
return f.read()