better goldwarden command path detection
in this way works always
This commit is contained in:
parent
f3196863bb
commit
200bce7d7e
@ -1,13 +1,19 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
import json
|
import json
|
||||||
|
from shutil import which
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
# if flatpak
|
# if flatpak
|
||||||
if os.path.exists("/app/bin/goldwarden"):
|
if os.path.exists("/app/bin/goldwarden"):
|
||||||
BINARY_PATH = "/app/bin/goldwarden"
|
BINARY_PATH = "/app/bin/goldwarden"
|
||||||
else:
|
else:
|
||||||
res = subprocess.run(["which", "goldwarden"])
|
BINARY_PATH = which('goldwarden')
|
||||||
BINARY_PATH = res.stdout.decode("utf-8").strip()
|
if isinstance(BINARY_PATH,str):
|
||||||
|
BINARY_PATH = BINARY_PATH.strip()
|
||||||
|
else:
|
||||||
|
print("goldwarden executable not found")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
def set_api_url(url):
|
def set_api_url(url):
|
||||||
restic_cmd = f"{BINARY_PATH} config 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"))
|
print(line.decode("utf-8"))
|
||||||
result.wait()
|
result.wait()
|
||||||
print("quitting goldwarden daemon")
|
print("quitting goldwarden daemon")
|
||||||
return result.returncode
|
return result.returncode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user