Skip to content

Commit 164d6ef

Browse files
committed
Return egg "done" checks as an array rather than a string
1 parent 26704a2 commit 164d6ef

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

app/Services/Eggs/EggConfigurationService.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,30 @@ public function handle(Server $server): array
5151
);
5252

5353
return [
54-
'startup' => json_decode($server->egg->inherit_config_startup),
54+
'startup' => $this->convertStartupToNewFormat(json_decode($server->egg->inherit_config_startup, true)),
5555
'stop' => $this->convertStopToNewFormat($server->egg->inherit_config_stop),
5656
'configs' => $configs,
5757
];
5858
}
5959

60+
/**
61+
* Convert the "done" variable into an array if it is not currently one.
62+
*
63+
* @param array $startup
64+
* @return array
65+
*/
66+
protected function convertStartupToNewFormat(array $startup)
67+
{
68+
$done = Arr::get($startup, 'done');
69+
70+
return array_filter([
71+
'done' => is_string($done) ? [$done] : $done,
72+
'user_interaction' => Arr::get($startup, 'userInteraction'),
73+
], function ($datum) {
74+
return ! is_null($datum);
75+
});
76+
}
77+
6078
/**
6179
* Converts a legacy stop string into a new generation stop option for a server.
6280
*

0 commit comments

Comments
 (0)