From 6dd9412fb684a14f6eebd952b59b69ec4dc948e8 Mon Sep 17 00:00:00 2001 From: Simon L Date: Fri, 30 Dec 2022 22:56:37 +0100 Subject: [PATCH] rename volume name to source and volume location to destination Signed-off-by: Simon L --- manual-install/update-yaml.sh | 4 +- php/containers-schema.json | 4 +- php/containers.json | 96 +++++++++++++------------- php/src/ContainerDefinitionFetcher.php | 40 +++++------ 4 files changed, 72 insertions(+), 72 deletions(-) diff --git a/manual-install/update-yaml.sh b/manual-install/update-yaml.sh index ca50abcc..980f7aad 100644 --- a/manual-install/update-yaml.sh +++ b/manual-install/update-yaml.sh @@ -1,7 +1,7 @@ #!/bin/bash jq -c . ./php/containers.json > /tmp/containers.json -sed -i 's|","location":"|:|g' /tmp/containers.json +sed -i 's|","destination":"|:|g' /tmp/containers.json sed -i 's|","writeable":false|:ro"|g' /tmp/containers.json sed -i 's|","writeable":true|:rw"|g' /tmp/containers.json OUTPUT="$(cat /tmp/containers.json)" @@ -20,7 +20,7 @@ sed -i "s|'||g" containers.yml sed -i '/display_name:/d' containers.yml sed -i '/stop_grace_period:/s/$/s/' containers.yml sed -i '/: \[\]/d' containers.yml -sed -i 's|- name: |- |' containers.yml +sed -i 's|- source: |- |' containers.yml TCP="$(grep -oP '[%A-Z0-9_]+/tcp' containers.yml | sort -u)" mapfile -t TCP <<< "$TCP" diff --git a/php/containers-schema.json b/php/containers-schema.json index b13da609..97c9e963 100644 --- a/php/containers-schema.json +++ b/php/containers-schema.json @@ -60,10 +60,10 @@ "additionalProperties": false, "minProperties": 3, "properties": { - "location": { + "destination": { "type": "string" }, - "name": { + "source": { "type": "string" }, "writeable": { diff --git a/php/containers.json b/php/containers.json index fb7fb679..869dc0fd 100644 --- a/php/containers.json +++ b/php/containers.json @@ -28,13 +28,13 @@ ], "volumes": [ { - "name": "nextcloud_aio_nextcloud", - "location": "/var/www/html", + "source": "nextcloud_aio_nextcloud", + "destination": "/var/www/html", "writeable": false }, { - "name": "nextcloud_aio_apache", - "location": "/mnt/data", + "source": "nextcloud_aio_apache", + "destination": "/mnt/data", "writeable": true } ], @@ -53,13 +53,13 @@ ], "volumes": [ { - "name": "nextcloud_aio_database", - "location": "/var/lib/postgresql/data", + "source": "nextcloud_aio_database", + "destination": "/var/lib/postgresql/data", "writeable": true }, { - "name": "nextcloud_aio_database_dump", - "location": "/mnt/data", + "source": "nextcloud_aio_database_dump", + "destination": "/mnt/data", "writeable": true } ], @@ -95,23 +95,23 @@ ], "volumes": [ { - "name": "nextcloud_aio_nextcloud", - "location": "/var/www/html", + "source": "nextcloud_aio_nextcloud", + "destination": "/var/www/html", "writeable": true }, { - "name": "%NEXTCLOUD_DATADIR%", - "location": "/mnt/ncdata", + "source": "%NEXTCLOUD_DATADIR%", + "destination": "/mnt/ncdata", "writeable": true }, { - "name": "%NEXTCLOUD_MOUNT%", - "location": "%NEXTCLOUD_MOUNT%", + "source": "%NEXTCLOUD_MOUNT%", + "destination": "%NEXTCLOUD_MOUNT%", "writeable": true }, { - "name": "%NEXTCLOUD_TRUSTED_CACERTS_DIR%", - "location": "/usr/local/share/ca-certificates", + "source": "%NEXTCLOUD_TRUSTED_CACERTS_DIR%", + "destination": "/usr/local/share/ca-certificates", "writeable": false } ], @@ -172,8 +172,8 @@ ], "volumes": [ { - "name": "nextcloud_aio_redis", - "location": "/data", + "source": "nextcloud_aio_redis", + "destination": "/data", "writeable": true } ], @@ -199,8 +199,8 @@ ], "volumes": [ { - "name": "nextcloud_aio_collabora_fonts", - "location": "/opt/cool/systemplate/tmpfonts", + "source": "nextcloud_aio_collabora_fonts", + "destination": "/opt/cool/systemplate/tmpfonts", "writeable": true } ], @@ -252,53 +252,53 @@ ], "volumes": [ { - "name": "nextcloud_aio_backup_cache", - "location": "/root", + "source": "nextcloud_aio_backup_cache", + "destination": "/root", "writeable": true }, { - "name": "nextcloud_aio_nextcloud", - "location": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud", + "source": "nextcloud_aio_nextcloud", + "destination": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud", "writeable": true }, { - "name": "%NEXTCLOUD_DATADIR%", - "location": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data", + "source": "%NEXTCLOUD_DATADIR%", + "destination": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data", "writeable": true }, { - "name": "nextcloud_aio_database", - "location": "/nextcloud_aio_volumes/nextcloud_aio_database", + "source": "nextcloud_aio_database", + "destination": "/nextcloud_aio_volumes/nextcloud_aio_database", "writeable": true }, { - "name": "nextcloud_aio_database_dump", - "location": "/nextcloud_aio_volumes/nextcloud_aio_database_dump", + "source": "nextcloud_aio_database_dump", + "destination": "/nextcloud_aio_volumes/nextcloud_aio_database_dump", "writeable": true }, { - "name": "nextcloud_aio_apache", - "location": "/nextcloud_aio_volumes/nextcloud_aio_apache", + "source": "nextcloud_aio_apache", + "destination": "/nextcloud_aio_volumes/nextcloud_aio_apache", "writeable": true }, { - "name": "nextcloud_aio_mastercontainer", - "location": "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer", + "source": "nextcloud_aio_mastercontainer", + "destination": "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer", "writeable": true }, { - "name": "%BORGBACKUP_HOST_LOCATION%", - "location": "/mnt/borgbackup", + "source": "%BORGBACKUP_HOST_LOCATION%", + "destination": "/mnt/borgbackup", "writeable": true }, { - "name": "nextcloud_aio_elasticsearch", - "location": "/nextcloud_aio_volumes/nextcloud_aio_elasticsearch", + "source": "nextcloud_aio_elasticsearch", + "destination": "/nextcloud_aio_volumes/nextcloud_aio_elasticsearch", "writeable": true }, { - "name": "nextcloud_aio_redis", - "location": "/mnt/redis", + "source": "nextcloud_aio_redis", + "destination": "/mnt/redis", "writeable": true } ], @@ -320,8 +320,8 @@ ], "volumes": [ { - "name": "%DOCKER_SOCKET_PATH%", - "location": "/var/run/docker.sock", + "source": "%DOCKER_SOCKET_PATH%", + "destination": "/var/run/docker.sock", "writeable": false } ], @@ -362,8 +362,8 @@ ], "volumes": [ { - "name": "nextcloud_aio_clamav", - "location": "/var/lib/clamav", + "source": "nextcloud_aio_clamav", + "destination": "/var/lib/clamav", "writeable": true } ], @@ -386,8 +386,8 @@ ], "volumes": [ { - "name": "nextcloud_aio_onlyoffice", - "location": "/var/lib/onlyoffice", + "source": "nextcloud_aio_onlyoffice", + "destination": "/var/lib/onlyoffice", "writeable": true } ], @@ -426,8 +426,8 @@ ], "volumes": [ { - "name": "nextcloud_aio_elasticsearch", - "location": "/usr/share/elasticsearch/data", + "source": "nextcloud_aio_elasticsearch", + "destination": "/usr/share/elasticsearch/data", "writeable": true } ], diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 8a5341bf..54adb4cb 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -94,43 +94,43 @@ class ContainerDefinitionFetcher $volumes = new ContainerVolumes(); foreach ($entry['volumes'] as $value) { - if($value['name'] === '%BORGBACKUP_HOST_LOCATION%') { - $value['name'] = $this->configurationManager->GetBorgBackupHostLocation(); - if($value['name'] === '') { + if($value['source'] === '%BORGBACKUP_HOST_LOCATION%') { + $value['source'] = $this->configurationManager->GetBorgBackupHostLocation(); + if($value['source'] === '') { continue; } } - if($value['name'] === '%NEXTCLOUD_MOUNT%') { - $value['name'] = $this->configurationManager->GetNextcloudMount(); - if($value['name'] === '') { + if($value['source'] === '%NEXTCLOUD_MOUNT%') { + $value['source'] = $this->configurationManager->GetNextcloudMount(); + if($value['source'] === '') { continue; } - } elseif ($value['name'] === '%NEXTCLOUD_DATADIR%') { - $value['name'] = $this->configurationManager->GetNextcloudDatadirMount(); - if ($value['name'] === '') { + } elseif ($value['source'] === '%NEXTCLOUD_DATADIR%') { + $value['source'] = $this->configurationManager->GetNextcloudDatadirMount(); + if ($value['source'] === '') { continue; } - } elseif ($value['name'] === '%DOCKER_SOCKET_PATH%') { - $value['name'] = $this->configurationManager->GetDockerSocketPath(); - if($value['name'] === '') { + } elseif ($value['source'] === '%DOCKER_SOCKET_PATH%') { + $value['source'] = $this->configurationManager->GetDockerSocketPath(); + if($value['source'] === '') { continue; } - } elseif ($value['name'] === '%NEXTCLOUD_TRUSTED_CACERTS_DIR%') { - $value['name'] = $this->configurationManager->GetTrustedCacertsDir(); - if($value['name'] === '') { + } elseif ($value['source'] === '%NEXTCLOUD_TRUSTED_CACERTS_DIR%') { + $value['source'] = $this->configurationManager->GetTrustedCacertsDir(); + if($value['source'] === '') { continue; } } - if ($value['location'] === '%NEXTCLOUD_MOUNT%') { - $value['location'] = $this->configurationManager->GetNextcloudMount(); - if($value['location'] === '') { + if ($value['destination'] === '%NEXTCLOUD_MOUNT%') { + $value['destination'] = $this->configurationManager->GetNextcloudMount(); + if($value['destination'] === '') { continue; } } $volumes->AddVolume( new ContainerVolume( - $value['name'], - $value['location'], + $value['source'], + $value['destination'], $value['writeable'] ) );