mirror of
https://github.com/skoelle/calender_sync.git
synced 2026-09-17 18:20:24 +00:00
feat: REST API + Web-Frontend für Kalenderübersicht
- FastAPI Backend mit /api/events, /api/events/{id}, /api/health Endpoints
- Optionale Suche nach Event-Titel (Query Parameter ?search=...)
- Jinja2 Web-Frontend auf / mit Suchfeld
- Shared DB Connection Module (api/database.py)
- Docker Compose: calendar-api Service hinzugefügt
- Sync.py refactored: nutzt shared database.py
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import os
|
||||
import mysql.connector
|
||||
|
||||
DB_HOST = os.environ.get("DB_HOST", "mariadb.fritz.box")
|
||||
DB_PORT = int(os.environ.get("DB_PORT", "3306"))
|
||||
DB_NAME = os.environ.get("DB_NAME", "calendar_sync")
|
||||
DB_USER = os.environ["DB_USER"]
|
||||
DB_PASSWORD = os.environ["DB_PASSWORD"]
|
||||
|
||||
|
||||
def get_connection(autocommit: bool = True):
|
||||
return mysql.connector.connect(
|
||||
host=DB_HOST,
|
||||
port=DB_PORT,
|
||||
user=DB_USER,
|
||||
password=DB_PASSWORD,
|
||||
database=DB_NAME,
|
||||
autocommit=autocommit,
|
||||
)
|
||||
Reference in New Issue
Block a user