mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-05 13:55:44 -05:00
Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
This commit is contained in:
co-authored by
Anthony
Sky Mulley
parent
98079a0166
commit
6c0413e39b
@@ -1,20 +1,55 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Api\Application\Nodes;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest;
|
||||
use Knuckles\Scribe\Attributes\Endpoint;
|
||||
use Knuckles\Scribe\Attributes\Group;
|
||||
use Knuckles\Scribe\Attributes\Response as ScribeResponse;
|
||||
use Knuckles\Scribe\Attributes\Subgroup;
|
||||
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeConfigurationRequest;
|
||||
use Pterodactyl\Models\Node;
|
||||
|
||||
#[Group('Application API', 'Root administrator endpoints for managing panel resources using application API tokens.')]
|
||||
#[Subgroup('Nodes', 'Create, update, retrieve, and delete Wings nodes and their allocations.')]
|
||||
class NodeConfigurationController extends ApplicationApiController
|
||||
{
|
||||
private const array CONFIGURATION_EXAMPLE = [
|
||||
'debug' => false,
|
||||
'uuid' => '3d8dd7f9-07a1-4d65-8db0-8c8921f2f4f7',
|
||||
'token_id' => 'abcdefghijklmnop',
|
||||
'token' => 'example-node-token',
|
||||
'api' => [
|
||||
'host' => '0.0.0.0',
|
||||
'port' => 8080,
|
||||
'ssl' => [
|
||||
'enabled' => true,
|
||||
'cert' => '/etc/letsencrypt/live/node.example.com/fullchain.pem',
|
||||
'key' => '/etc/letsencrypt/live/node.example.com/privkey.pem',
|
||||
],
|
||||
'upload_limit' => 100,
|
||||
],
|
||||
'system' => [
|
||||
'data' => '/var/lib/pterodactyl/volumes',
|
||||
'sftp' => [
|
||||
'bind_port' => 2022,
|
||||
],
|
||||
],
|
||||
'allowed_mounts' => ['/mnt/shared'],
|
||||
'remote' => 'https://panel.example.test',
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns the configuration information for a node. This allows for automated deployments
|
||||
* to remote machines so long as an API key is provided to the machine to make the request
|
||||
* with, and the node is known.
|
||||
*/
|
||||
public function __invoke(GetNodeRequest $request, Node $node): JsonResponse
|
||||
#[Endpoint('Get node configuration', 'Returns the Wings configuration payload for a node, including node authentication tokens. Requires write access to nodes.')]
|
||||
#[ScribeResponse(self::CONFIGURATION_EXAMPLE, status: 200, description: 'Node configuration.')]
|
||||
public function __invoke(GetNodeConfigurationRequest $request, Node $node): JsonResponse
|
||||
{
|
||||
return new JsonResponse($node->getConfiguration());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user