feat(service): add Elasticsearch password handling in extraFields method

- Implemented logic to retrieve and display the default user password for Elasticsearch in the extraFields method of the Service model.
- Enhanced data collection for environment variables related to Elasticsearch, improving service configuration management.
This commit is contained in:
Andras Bacsai
2025-10-03 20:05:32 +02:00
parent b4cfb78f86
commit 4cf600445a
3 changed files with 59 additions and 0 deletions

View File

@@ -547,6 +547,21 @@ class Service extends BaseModel
}
$fields->put('Grafana', $data->toArray());
break;
case $image->contains('elasticsearch'):
$data = collect([]);
$elastic_password = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_ELASTICSEARCH')->first();
if ($elastic_password) {
$data = $data->merge([
'Password (default user: elastic)' => [
'key' => data_get($elastic_password, 'key'),
'value' => data_get($elastic_password, 'value'),
'rules' => 'required',
'isPassword' => true,
],
]);
}
$fields->put('Elasticsearch', $data->toArray());
break;
case $image->contains('directus'):
$data = collect([]);
$admin_email = $this->environment_variables()->where('key', 'ADMIN_EMAIL')->first();