20 lines
677 B
Python
20 lines
677 B
Python
|
A
|
from .base import CoreAdapter
|
||
|
|
from typing import Optional
|
||
|
|
|
||
|
|
|
||
|
|
def get_adapter(config: dict) -> Optional[CoreAdapter]:
|
||
|
|
"""Factory: return the configured core adapter, or None for export-only mode."""
|
||
|
|
core_cfg = config.get("core", {})
|
||
|
|
core_type = core_cfg.get("type", "none")
|
||
|
|
uri = core_cfg.get("mongodb_uri", "mongodb://localhost:27017")
|
||
|
|
db_name = core_cfg.get("database_name", "open5gs")
|
||
|
|
|
||
|
|
if core_type == "open5gs":
|
||
|
|
from .open5gs import Open5GSAdapter
|
||
|
|
return Open5GSAdapter(uri, db_name)
|
||
|
|
elif core_type == "free5gc":
|
||
|
|
from .free5gc import Free5GCAdapter
|
||
|
|
return Free5GCAdapter(uri, db_name)
|
||
|
|
else:
|
||
|
|
return None
|