diff --git a/app/Livewire/Project/Service/StackForm.php b/app/Livewire/Project/Service/StackForm.php index 03bf99245..232e0ee3f 100644 --- a/app/Livewire/Project/Service/StackForm.php +++ b/app/Livewire/Project/Service/StackForm.php @@ -42,7 +42,7 @@ public function mount() $this->validationAttributes["fields.$key.value"] = $fieldKey; } } - $this->fields = $this->fields->sortDesc(); + //$this->fields = $this->fields->sortDesc(); } public function saveCompose($raw) { @@ -52,7 +52,7 @@ public function saveCompose($raw) public function instantSave() { $this->service->save(); - $this->dispatch('success', 'Service settings saved.'); + $this->dispatch('success', 'Service settings saved.'); } public function submit() diff --git a/app/Models/Service.php b/app/Models/Service.php index 9bd4a0cdc..6a54729ae 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -472,6 +472,63 @@ public function extraFields() } $fields->put('Admin', $data->toArray()); break; + case str($image)?->contains('vaultwarden'): + $data = collect([]); + + $DATABASE_URL = $this->environment_variables()->where('key', 'DATABASE_URL')->first(); + $ADMIN_TOKEN = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_64_ADMIN')->first(); + + $PUSH_ENABLED = $this->environment_variables()->where('key', 'PUSH_ENABLED')->first(); + $PUSH_INSTALLATION_ID = $this->environment_variables()->where('key', 'PUSH_SERVICE_ID')->first(); + $PUSH_INSTALLATION_KEY = $this->environment_variables()->where('key', 'PUSH_SERVICE_KEY')->first(); + + if ($DATABASE_URL) { + $data = $data->merge([ + 'Database URL' => [ + 'key' => data_get($DATABASE_URL, 'key'), + 'value' => data_get($DATABASE_URL, 'value'), + ], + ]); + } + if ($ADMIN_TOKEN) { + $data = $data->merge([ + 'Admin Password' => [ + 'key' => data_get($ADMIN_TOKEN, 'key'), + 'value' => data_get($ADMIN_TOKEN, 'value'), + 'isPassword' => true, + ], + ]); + } + + if ($PUSH_ENABLED) { + $data = $data->merge([ + 'Push Enabled' => [ + 'key' => data_get($PUSH_ENABLED, 'key'), + 'value' => data_get($PUSH_ENABLED, 'value'), + 'rules' => 'required|string|in:true,false', + ], + ]); + } + if ($PUSH_INSTALLATION_ID) { + $data = $data->merge([ + 'Push Installation ID' => [ + 'key' => data_get($PUSH_INSTALLATION_ID, 'key'), + 'value' => data_get($PUSH_INSTALLATION_ID, 'value'), + ], + ]); + } + if ($PUSH_INSTALLATION_KEY) { + $data = $data->merge([ + 'Push Installation Key' => [ + 'key' => data_get($PUSH_INSTALLATION_KEY, 'key'), + 'value' => data_get($PUSH_INSTALLATION_KEY, 'value'), + 'isPassword' => true, + ], + ]); + } + + $fields->put('Vaultwarden', $data); + break; } } $databases = $this->databases()->get(); diff --git a/templates/compose/vaultwarden.yaml b/templates/compose/vaultwarden.yaml index e4b6fbffc..e2f8281d8 100644 --- a/templates/compose/vaultwarden.yaml +++ b/templates/compose/vaultwarden.yaml @@ -8,6 +8,14 @@ services: image: vaultwarden/server:latest environment: - SERVICE_FQDN_VAULTWARDEN + - DOMAIN=${SERVICE_FQDN_VAULTWARDEN} + - DATABASE_URL=${VAULTWARDEN_DB_URL:-data/db.sqlite3} + - SIGNUPS_ALLOWED=${SIGNUP_ALLOWED:-true} + - ADMIN_TOKEN=${SERVICE_PASSWORD_64_ADMIN} + - IP_HEADER=X-Forwarded-For + - PUSH_ENABLED=${PUSH_ENABLED:-false} + - PUSH_INSTALLATION_ID=${PUSH_SERVICE_ID} + - PUSH_INSTALLATION_KEY=${PUSH_SERVICE_KEY} volumes: - vaultwarden-data:/data healthcheck: