fix: Create user_data dir if it doesn't exist
All checks were successful
Build Docker / Build Image (push) Successful in 43s

This commit is contained in:
Nathan Woodburn 2024-11-22 09:47:37 +11:00
parent 3290240a25
commit 6c91ec88c7
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -10,6 +10,8 @@ ip = os.getenv("hsd_ip")
if ip is None: if ip is None:
ip = "localhost" ip = "localhost"
if not os.path.exists("user_data"):
os.mkdir("user_data")
# Plugin Data # Plugin Data
info = { info = {
@ -96,6 +98,8 @@ def automation(params, authentication):
def disable(params, authentication): def disable(params, authentication):
# Create walletname file in user_data # Create walletname file in user_data
wallet = authentication.split(":")[0] wallet = authentication.split(":")[0]
if not os.path.exists("user_data"):
os.mkdir("user_data")
with open(f"user_data/{wallet}.autoRenew", "w") as f: with open(f"user_data/{wallet}.autoRenew", "w") as f:
f.write(f"This file is used to disable automations for '{wallet}' wallet.\nDelete this file to enable automations.") f.write(f"This file is used to disable automations for '{wallet}' wallet.\nDelete this file to enable automations.")
return {"Status": "Disabled Automations"} return {"Status": "Disabled Automations"}