From 6ae87466ca6fd77aa506fe940537055e80c62657 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 11 Dec 2023 21:19:45 +0100 Subject: [PATCH] fix: only allow to modify in .env file if AUTOUPDATE is set --- .env.production | 2 -- .../views/livewire/settings/configuration.blade.php | 6 +++++- scripts/install.sh | 13 ++++++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.env.production b/.env.production index d92c9ce27..f15a8b0e9 100644 --- a/.env.production +++ b/.env.production @@ -8,5 +8,3 @@ REDIS_PASSWORD= PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= - -AUTOUPDATE=true diff --git a/resources/views/livewire/settings/configuration.blade.php b/resources/views/livewire/settings/configuration.blade.php index 2a31e840a..a47da5b21 100644 --- a/resources/views/livewire/settings/configuration.blade.php +++ b/resources/views/livewire/settings/configuration.blade.php @@ -21,7 +21,11 @@

Advanced

- + @if (env('AUTOUPDATE') == 'true') + + @else + + @endif @if ($next_channel) diff --git a/scripts/install.sh b/scripts/install.sh index 5716ba2b6..eed99dbbb 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -106,9 +106,9 @@ cat >/etc/docker/daemon.json.coolify < "$TEMP_FILE"; then - echo "Error merging JSON files" - exit 1 +if ! jq -s '.[0] * .[1]' /etc/docker/daemon.json /etc/docker/daemon.json.coolify >"$TEMP_FILE"; then + echo "Error merging JSON files" + exit 1 fi mv "$TEMP_FILE" /etc/docker/daemon.json @@ -156,9 +156,12 @@ fi # Merge .env and .env.production. New values will be added to .env sort -u -t '=' -k 1,1 /data/coolify/source/.env /data/coolify/source/.env.production | sed '/^$/d' >/data/coolify/source/.env.temp && mv /data/coolify/source/.env.temp /data/coolify/source/.env -# Check if AUTOUPDATE value is true in env, not in env file and it is not set in .env if [ "$AUTOUPDATE" = "false" ]; then - sed -i "s|AUTOUPDATE=.*|AUTOUPDATE=false|g" /data/coolify/source/.env + if ! grep -q "AUTOUPDATE=" /data/coolify/source/.env; then + echo "AUTOUPDATE=false" >>/data/coolify/source/.env + else + sed -i "s|AUTOUPDATE=.*|AUTOUPDATE=false|g" /data/coolify/source/.env + fi fi # Generate an ssh key (ed25519) at /data/coolify/ssh/keys/id.root@host.docker.internal