mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-07 08:52:35 +00:00
Plugins base (#613)
* wip * wip * cleanup * notification channels * phpstan * services * remove server types * refactoring * refactoring
This commit is contained in:
@ -17,7 +17,12 @@ public function install(Server $server, array $input): Service
|
||||
{
|
||||
Validator::make($input, self::rules($input))->validate();
|
||||
|
||||
$input['type'] = config('core.service_types')[$input['name']];
|
||||
$name = $input['name'];
|
||||
$input['type'] = config("service.services.$name.type");
|
||||
|
||||
if (! $input['type']) {
|
||||
throw new \InvalidArgumentException("Service type is not defined for $name");
|
||||
}
|
||||
|
||||
$service = new Service([
|
||||
'server_id' => $server->id,
|
||||
@ -55,14 +60,14 @@ public static function rules(array $input): array
|
||||
$rules = [
|
||||
'name' => [
|
||||
'required',
|
||||
Rule::in(array_keys(config('core.service_types'))),
|
||||
Rule::in(array_keys(config('service.services'))),
|
||||
],
|
||||
'version' => [
|
||||
'required',
|
||||
],
|
||||
];
|
||||
if (isset($input['name'])) {
|
||||
$rules['version'][] = Rule::in(config("core.service_versions.{$input['name']}"));
|
||||
$rules['version'][] = Rule::in(config("service.services.{$input['name']}.versions", []));
|
||||
}
|
||||
|
||||
return $rules;
|
||||
|
Reference in New Issue
Block a user