Merge pull request 'secrets/generate-private-key: just create parent opportunistically' (#522) from Mic92-sops-nix into main
All checks were successful
assets1 / test (push) Successful in 20s
checks / test (push) Successful in 42s
checks-impure / test (push) Successful in 1m26s

This commit is contained in:
clan-bot 2023-11-16 12:21:39 +00:00
commit 91b6094704

View File

@ -10,8 +10,7 @@ def generate_key() -> str:
if path.exists():
raise ClanError(f"Key already exists at {path}")
priv_key, pub_key = generate_private_key()
if not (parent := path.parent).exists():
parent.mkdir(parents=True, exist_ok=True)
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(priv_key)
return pub_key