A
0be02bd1f4
- Fix FileNotFoundError when database.path has no directory component (os.makedirs(os.path.dirname(path)) with path="subscribers.db" raised). Add ensure_parent_dir helper; use it in app.py and scripts/init_db.py. - Open5GS/free5gc adapters now use profile.apn for the core session/DNN name instead of a hardcoded "internet"; apn is threaded through get_adapter. Tests: +4 (ensure_parent_dir, adapter APN); 82 pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
23 lines
557 B
Python
23 lines
557 B
Python
#!/usr/bin/env python3
|
|
"""Initialize the SQLite subscriber database."""
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
from server.database import init_db
|
|
from server.utils import ensure_parent_dir, load_config
|
|
|
|
|
|
def main():
|
|
config_path = os.environ.get("CONFIG_PATH", "config.yaml")
|
|
cfg = load_config(config_path)
|
|
db_path = cfg["database"]["path"]
|
|
ensure_parent_dir(db_path)
|
|
init_db(db_path)
|
|
print(f"Database initialized at {db_path}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|