fix: only allow to modify in .env file if AUTOUPDATE is set

This commit is contained in:
Andras Bacsai 2023-12-11 21:19:45 +01:00
parent 5159d47159
commit 6ae87466ca
3 changed files with 13 additions and 8 deletions

View File

@ -8,5 +8,3 @@ REDIS_PASSWORD=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
AUTOUPDATE=true

View File

@ -21,7 +21,11 @@
</form>
<h2 class="pt-6">Advanced</h2>
<div class="flex flex-col py-6 text-right w-80">
@if (env('AUTOUPDATE') == 'true')
<x-forms.checkbox instantSave helper="AUTOUPDATE is set in .env file, you need to modify it there." disabled id="is_auto_update_enabled" label="Auto Update Coolify" />
@else
<x-forms.checkbox instantSave id="is_auto_update_enabled" label="Auto Update Coolify" />
@endif
<x-forms.checkbox instantSave id="is_registration_enabled" label="Registration Allowed" />
<x-forms.checkbox instantSave id="do_not_track" label="Do Not Track" />
@if ($next_channel)

View File

@ -156,10 +156,13 @@ 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
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
if [ ! -f /data/coolify/ssh/keys/id.root@host.docker.internal ]; then