recator moderation-script
This commit is contained in:
@@ -8,6 +8,7 @@ from pathlib import Path
|
||||
import shlex
|
||||
import sqlite3
|
||||
import sys
|
||||
import re
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
@@ -16,9 +17,9 @@ def database_path(project_root):
|
||||
"""Liest die .env; bereits gesetzte Umgebungsvariablen haben Vorrang."""
|
||||
settings = {}
|
||||
env_file = project_root / ".env"
|
||||
if env_file.is_file():
|
||||
try:
|
||||
for number, line in enumerate(env_file.read_text(encoding="utf-8-sig").splitlines(), 1):
|
||||
line = line.strip()
|
||||
line = re.sub(r'^\s*export\s+', '', line).strip()
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
if line.startswith("export "):
|
||||
|
||||
Reference in New Issue
Block a user