mirror of
https://github.com/skoelle/calender_sync.git
synced 2026-09-17 18:20:24 +00:00
23 lines
649 B
Python
23 lines
649 B
Python
# Copyright (c) 2026 Stefan Koelle (https://stefankoelle.de)
|
|
# Licensed under the MIT License. See LICENSE file in project root for details.
|
|
|
|
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,
|
|
)
|