fix(neo4j): create missing neo4j_connection module with basic_auth

Health check imports app.core.neo4j_connection._driver but the module
did not exist, causing neo4j health to always return False.
This commit is contained in:
Crypto Rug Munch 2026-07-08 07:27:46 +02:00
parent 6ef3b694ce
commit 765424b7df

View file

@ -0,0 +1,28 @@
"""Neo4j driver singleton for health checks and graph queries."""
from __future__ import annotations
import logging
import os
log = logging.getLogger(__name__)
_driver = None
def _init() -> None:
global _driver
if _driver is not None:
return
try:
from neo4j import GraphDatabase, basic_auth
uri = os.getenv("NEO4J_URI", "bolt://rmi-neo4j:7687")
user = os.getenv("NEO4J_USER", "neo4j")
password = os.getenv("NEO4J_PASSWORD", "password")
_driver = GraphDatabase.driver(uri, auth=basic_auth(user, password))
log.info("neo4j_driver_connected")
except Exception as exc:
log.warning("neo4j_driver_init_failed err=%s", exc)
_driver = None
_init()