23 lines
564 B
Python
23 lines
564 B
Python
|
A
|
#!/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 load_config
|
||
|
|
|
||
|
|
|
||
|
|
def main():
|
||
|
|
config_path = os.environ.get("CONFIG_PATH", "config.yaml")
|
||
|
|
cfg = load_config(config_path)
|
||
|
|
db_path = cfg["database"]["path"]
|
||
|
|
os.makedirs(os.path.dirname(db_path), exist_ok=True)
|
||
|
|
init_db(db_path)
|
||
|
|
print(f"Database initialized at {db_path}")
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|