Skip to content

Commit

Permalink
get_security_dir: legacy=False default
Browse files Browse the repository at this point in the history
ThomasWaldmann committed Feb 3, 2023
1 parent 1d4810a commit bde0f11
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/borg/helpers/fs.py
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ def get_keys_dir(*, legacy=False):
return keys_dir


def get_security_dir(repository_id=None, *, legacy=True):
def get_security_dir(repository_id=None, *, legacy=False):
"""Determine where to store local security information."""
security_dir = os.environ.get("BORG_SECURITY_DIR")
if security_dir is None:
12 changes: 10 additions & 2 deletions src/borg/testsuite/helpers.py
Original file line number Diff line number Diff line change
@@ -693,12 +693,20 @@ def test_get_security_dir(monkeypatch):
monkeypatch.delenv("BORG_BASE_DIR", raising=False)
if is_win32:
monkeypatch.delenv("BORG_SECURITY_DIR", raising=False)
assert get_security_dir(legacy=False) == os.path.join(
assert get_security_dir() == os.path.join(
os.path.expanduser("~"), "AppData", "Local", "borg", "borg", "security"
)
assert get_security_dir(repository_id="1234", legacy=False) == os.path.join(
assert get_security_dir(repository_id="1234") == os.path.join(
os.path.expanduser("~"), "AppData", "Local", "borg", "borg", "security", "1234"
)
elif is_darwin:
monkeypatch.delenv("BORG_SECURITY_DIR", raising=False)
assert get_security_dir() == os.path.join(os.path.expanduser("~"), "Library", "Preferences", "borg", "security")
assert get_security_dir(repository_id="1234") == os.path.join(
os.path.expanduser("~"), "Library", "Preferences", "borg", "security", "1234"
)
monkeypatch.setenv("BORG_SECURITY_DIR", "/var/tmp")
assert get_security_dir() == "/var/tmp"
else:
monkeypatch.delenv("XDG_CONFIG_HOME", raising=False)
monkeypatch.delenv("BORG_SECURITY_DIR", raising=False)

0 comments on commit bde0f11

Please sign in to comment.