47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
AUTH.4C1 — c5-save-executor Runtime Entrypoint (SAVE-only, fail-closed).
|
|
Startet den verdrahteten SAVE-Worker-Loop. Health/Status-Modus.
|
|
"""
|
|
import json
|
|
import os
|
|
import sys
|
|
|
|
from job_store import JobStore
|
|
|
|
SCOPE = "SAVE"
|
|
DB_PATH = os.environ.get("C5_SAVE_DB", "/data/c5a_save.db")
|
|
VERSION = "0.1.0-auth4c1-wired"
|
|
|
|
|
|
def health() -> dict:
|
|
credential_present = bool(os.environ.get("TOLARIA_SAVE_TOKEN"))
|
|
db_ready = False
|
|
try:
|
|
store = JobStore(DB_PATH, SCOPE)
|
|
store.close()
|
|
db_ready = True
|
|
except Exception:
|
|
db_ready = False
|
|
return {
|
|
"service": "c5-save-executor",
|
|
"version": VERSION,
|
|
"mode": "fail_closed" if not credential_present else "credential_present",
|
|
"credential_present": credential_present,
|
|
"job_db_ready": db_ready,
|
|
"state": "idle" if not credential_present else "blocked",
|
|
"last_error": None,
|
|
}
|
|
|
|
|
|
def main() -> int:
|
|
if "--health" in sys.argv or "--status" in sys.argv:
|
|
print(json.dumps(health(), indent=2))
|
|
return 0
|
|
# Worker-Loop starten (verdrahtet, fail-closed)
|
|
from worker import main as worker_main
|
|
return worker_main()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|