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