Support outputting all of the nodes on the instance

This commit is contained in:
DaneEveritt 2022-05-13 21:49:06 -04:00
parent 3f47d7a12c
commit 97a7959096
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 42 additions and 2 deletions

View file

@ -15,14 +15,20 @@ class NodeConfigurationCommand extends Command
public function handle()
{
$column = ctype_digit((string) $this->argument('node')) ? 'id' : 'uuid';
/** @var \Pterodactyl\Models\Node $node */
$node = Node::query()->findOrFail($this->argument('node'));
$node = Node::query()->where($column, $this->argument('node'))->firstOr(function () {
$this->error('The selected node does not exist.');
exit(1);
});
$format = $this->option('format');
if (!in_array($format, ['yaml', 'yml', 'json'])) {
$this->error('Invalid format specified. Valid options are "yaml" and "json".');
return 1;
exit(1);
}
if ($format === 'json') {