From 53cd3091f7e5a173dbceda727b32aa375edad01a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 4 Mar 2024 12:46:33 +0100 Subject: [PATCH] Add Directus service fields to extraFields method --- app/Models/Service.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/Models/Service.php b/app/Models/Service.php index e8b0c97f0..3e6d2b9db 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -102,6 +102,32 @@ public function extraFields() foreach ($applications as $application) { $image = str($application->image)->before(':')->value(); switch ($image) { + case str($image)?->contains('directus'): + $data = collect([]); + $admin_email = $this->environment_variables()->where('key', 'ADMIN_EMAIL')->first(); + $admin_password = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_ADMIN')->first(); + + if ($admin_email) { + $data = $data->merge([ + 'Admin Email' => [ + 'key' => data_get($admin_email, 'key'), + 'value' => data_get($admin_email, 'value'), + 'rules' => 'required|email', + ], + ]); + } + if ($admin_password) { + $data = $data->merge([ + 'Admin Password' => [ + 'key' => data_get($admin_password, 'key'), + 'value' => data_get($admin_password, 'value'), + 'rules' => 'required', + 'isPassword' => true, + ], + ]); + } + $fields->put('Directus', $data); + break; case str($image)?->contains('kong'): $data = collect([]); $dashboard_user = $this->environment_variables()->where('key', 'SERVICE_USER_ADMIN')->first();