Compare commits

..
1 Commits
4 changed files with 12 additions and 6 deletions
+3 -1
View File
@@ -185,7 +185,9 @@ def _resolve_confdir(args):
def _confdir(args):
confdir = _resolve_confdir(args)
config.init_confdir(confdir)
if confdir is not None:
os.environ["CISTA_HOME"] = confdir.as_posix()
config.init_confdir()
def _user(args):
+3 -3
View File
@@ -63,10 +63,10 @@ config: Config
conffile: Path
def init_confdir(confdir: Path | str | None = None) -> None:
def init_confdir() -> None:
global conffile
if confdir is not None:
home = Path(confdir).expanduser()
if p := os.environ.get("CISTA_HOME"):
home = Path(p)
else:
xdg = os.environ.get("XDG_CONFIG_HOME")
home = (
+3 -1
View File
@@ -129,7 +129,9 @@ def log_reachable_info() -> None:
def setup_docker(confdir: Path | None = None) -> int:
"""Build and run the patched OnlyOffice Docker image."""
config.init_confdir(confdir)
if confdir is not None:
os.environ["CISTA_HOME"] = confdir.as_posix()
config.init_confdir()
if config.conffile.exists():
config.load_config()
else:
+3 -1
View File
@@ -1,3 +1,4 @@
import os
from pathlib import Path, PurePath
from uuid import uuid4
@@ -23,7 +24,8 @@ def _persist_config():
@pytest.fixture
def setup_storage(tmp_path: Path):
config.init_confdir(tmp_path)
os.environ["CISTA_HOME"] = str(tmp_path)
config.init_confdir()
user = config.User()
auth.set_password(user, "secret")
admin = config.User(privileged=True)