From f4e5e0e35e48d3aae480874f50330298e97a5c59 Mon Sep 17 00:00:00 2001 From: Aaron Dewes Date: Sat, 6 Nov 2021 21:16:18 +0000 Subject: [PATCH] Extend app standard with custom bitcoin mount dir --- app/app-standard-v1.json | 4 ++++ app/lib/composegenerator/shared/main.py | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/app/app-standard-v1.json b/app/app-standard-v1.json index 2223087..e24fed8 100644 --- a/app/app-standard-v1.json +++ b/app/app-standard-v1.json @@ -150,6 +150,10 @@ "type": ["string", "array"], "description": "The entrypoint for the container" }, + "bitcoin_mount_dir": { + "type": "string", + "description": "Where to mount the bitcoin dir" + }, "command": { "type": ["string", "array"], "description": "The command for the container" diff --git a/app/lib/composegenerator/shared/main.py b/app/lib/composegenerator/shared/main.py index 024a0ca..3f1444d 100644 --- a/app/lib/composegenerator/shared/main.py +++ b/app/lib/composegenerator/shared/main.py @@ -43,6 +43,18 @@ def convertDataDirToVolume(app: dict): print("Data dir " + dataDir + " contains invalid characters") del container['data'] + if 'bitcoin_mount_dir' in container: + if not 'permissions' in container or not 'bitcoind' in container['permissions']: + print("Warning: container {} of app {} defines bitcoin_mount_dir but has no permissions for bitcoind".format(container['name'], app['metadata']['name'])) + # Skip this container + continue + if not 'volumes' in container: + container['volumes'] = [] + # Also skip the container if container['bitcoin_mount_dir'] contains a : + if(container['bitcoin_mount_dir'].find(":") == -1): + container['volumes'].append('"${BITCOIN_DATA_DIR}:' + container['bitcoin_mount_dir'] + ':ro"') + del container['bitcoin_mount_dir'] + return app def addStopConfig(app: dict):