diff --git a/cista/__main__.py b/cista/__main__.py index 407c60f..f50bfb8 100644 --- a/cista/__main__.py +++ b/cista/__main__.py @@ -1,3 +1,4 @@ +import os import sys from pathlib import Path @@ -117,6 +118,7 @@ def _confdir(args): raise ValueError("Config path is not a directory") # Accidentally pointed to the db.toml, use parent confdir = confdir.parent + os.environ["CISTA_HOME"] = confdir.as_posix() config.conffile = confdir / config.conffile.name diff --git a/cista/app.py b/cista/app.py index 7cad9a4..bdacb03 100644 --- a/cista/app.py +++ b/cista/app.py @@ -36,7 +36,6 @@ app.exception(Exception)(handle_sanic_exception) async def main_start(app, loop): tracemalloc.start() config.load_config() - print(config.config, config.config.public) app.ctx.threadexec = ThreadPoolExecutor( max_workers=3, thread_name_prefix="cista-ioworker" ) diff --git a/cista/config.py b/cista/config.py index 3ecf9af..823451d 100644 --- a/cista/config.py +++ b/cista/config.py @@ -1,5 +1,6 @@ from __future__ import annotations +import os import secrets import sys from functools import wraps @@ -33,7 +34,7 @@ class Link(msgspec.Struct, omit_defaults=True): config = None -conffile = Path.home() / ".local/share/cista/db.toml" +conffile = os.environ.get("CISTA_HOME") or Path.home() / ".local/share/cista/db.toml" def derived_secret(*params, len=8) -> bytes: diff --git a/cista/droppy.py b/cista/droppy.py index cb77d80..3271611 100644 --- a/cista/droppy.py +++ b/cista/droppy.py @@ -5,7 +5,6 @@ import msgspec def readconf() -> dict: p = Path.home() / ".droppy/config" # Hardcoded in Droppy - print("Reading Droppy config", p) cf = msgspec.json.decode((p / "config.json").read_bytes()) db = msgspec.json.decode((p / "db.json").read_bytes()) cf["path"] = p.parent / "files"