From 424437446d39ef8444d820fe7008f66e175c79e8 Mon Sep 17 00:00:00 2001 From: iamEvan Date: Mon, 27 May 2024 23:40:35 +0100 Subject: [PATCH] Added Push Notification Variables --- app/Models/Service.php | 31 ++++++++++++++++++++++++++++++ templates/compose/vaultwarden.yaml | 3 +++ 2 files changed, 34 insertions(+) diff --git a/app/Models/Service.php b/app/Models/Service.php index ffab20d984..69869a2a61 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -486,6 +486,10 @@ public function extraFields() $SMTP_SECURITY = $this->environment_variables()->where('key', 'SMTP_SECURITY')->first(); $SMTP_PORT = $this->environment_variables()->where('key', 'SMTP_PORT')->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' => [ @@ -566,6 +570,33 @@ public function extraFields() ]); } + 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; } diff --git a/templates/compose/vaultwarden.yaml b/templates/compose/vaultwarden.yaml index a0a12e9773..763e6dfddf 100644 --- a/templates/compose/vaultwarden.yaml +++ b/templates/compose/vaultwarden.yaml @@ -20,6 +20,9 @@ services: - SMTP_SECURITY=${SMTP_SECURITY:-starttls} - SMTP_PORT=${SMTP_PORT} - SMTP_TIMEOUT=15 + - PUSH_ENABLED=${PUSH_ENABLED:-false} + - PUSH_INSTALLATION_ID=${PUSH_SERVICE_ID} + - PUSH_INSTALLATION_KEY=${PUSH_SERVICE_KEY} volumes: - vaultwarden-data:/data healthcheck: