better goldwarden command path detection

in this way works always
This commit is contained in:
Daniele Scasciafratte 2024-02-09 15:57:58 +01:00 committed by GitHub
parent f3196863bb
commit 200bce7d7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 3 deletions

View File

@ -1,13 +1,19 @@
import subprocess
import json
from shutil import which
import os
import sys
# if flatpak
if os.path.exists("/app/bin/goldwarden"):
BINARY_PATH = "/app/bin/goldwarden"
else:
res = subprocess.run(["which", "goldwarden"])
BINARY_PATH = res.stdout.decode("utf-8").strip()
BINARY_PATH = which('goldwarden')
if isinstance(BINARY_PATH,str):
BINARY_PATH = BINARY_PATH.strip()
else:
print("goldwarden executable not found")
sys.exit()
def set_api_url(url):
restic_cmd = f"{BINARY_PATH} config set-api-url {url}"
@ -181,4 +187,4 @@ def run_daemon():
print(line.decode("utf-8"))
result.wait()
print("quitting goldwarden daemon")
return result.returncode
return result.returncode