From 8a8000c80a957d88f0c975e61f892a10ca9c18c9 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 16 Apr 2024 12:41:28 +0200 Subject: [PATCH] Add Unleash service configuration to Service model --- app/Models/Service.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/Models/Service.php b/app/Models/Service.php index bcffa0863..f5a47ac45 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -150,6 +150,29 @@ class Service extends BaseModel foreach ($applications as $application) { $image = str($application->image)->before(':')->value(); switch ($image) { + case str($image)?->contains('unleash-server'): + $data = collect([]); + $admin_password = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_UNLEASH')->first(); + $data = $data->merge([ + 'Admin User' => [ + 'key' => 'SERVICE_USER_UNLEASH', + 'value' => 'admin', + 'readonly' => true, + 'rules' => 'required', + ], + ]); + if ($admin_password) { + $data = $data->merge([ + 'Admin Password' => [ + 'key' => 'SERVICE_PASSWORD_UNLEASH', + 'value' => data_get($admin_password, 'value'), + 'rules' => 'required', + 'isPassword' => true, + ], + ]); + } + $fields->put('Unleash', $data); + break; case str($image)?->contains('grafana'): $data = collect([]); $admin_password = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_GRAFANA')->first();