#!/usr/bin/env python3 """Importiert die Tenants aus ../transkript-platform in die Admin-DB. python scripts/import_tenants.py # nur Schlüsselnamen der Secrets python scripts/import_tenants.py --with-secrets # Secrets via `sops -d` entschlüsseln und verschlüsselt speichern python scripts/import_tenants.py --force # neue Version auch bei identischem Inhalt """ import argparse import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) from app.db import init_db, session # noqa: E402 from app.services.importer import import_all # noqa: E402 from app.settings import LEGACY_PLATFORM # noqa: E402 ap = argparse.ArgumentParser() ap.add_argument("--root", default=str(LEGACY_PLATFORM)) ap.add_argument("--with-secrets", action="store_true") ap.add_argument("--force", action="store_true") a = ap.parse_args() init_db() with session() as db: for line in import_all(db, Path(a.root), a.with_secrets, a.force): print(line)