Extend app standard with custom bitcoin mount dir

This commit is contained in:
Aaron Dewes 2021-11-06 21:16:18 +00:00
parent c52a0dd222
commit f4e5e0e35e
2 changed files with 16 additions and 0 deletions

View File

@ -150,6 +150,10 @@
"type": ["string", "array"], "type": ["string", "array"],
"description": "The entrypoint for the container" "description": "The entrypoint for the container"
}, },
"bitcoin_mount_dir": {
"type": "string",
"description": "Where to mount the bitcoin dir"
},
"command": { "command": {
"type": ["string", "array"], "type": ["string", "array"],
"description": "The command for the container" "description": "The command for the container"

View File

@ -43,6 +43,18 @@ def convertDataDirToVolume(app: dict):
print("Data dir " + dataDir + print("Data dir " + dataDir +
" contains invalid characters") " contains invalid characters")
del container['data'] 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 return app
def addStopConfig(app: dict): def addStopConfig(app: dict):