2017-08-05 22:20:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Repositories\Daemon;
|
|
|
|
|
2018-01-06 00:27:47 +00:00
|
|
|
use Psr\Http\Message\ResponseInterface;
|
2017-08-05 22:20:07 +00:00
|
|
|
use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;
|
|
|
|
|
|
|
|
class ConfigurationRepository extends BaseRepository implements ConfigurationRepositoryInterface
|
|
|
|
{
|
|
|
|
/**
|
2018-01-06 00:27:47 +00:00
|
|
|
* Update the configuration details for the specified node using data from the database.
|
|
|
|
*
|
|
|
|
* @param array $overrides
|
|
|
|
* @return \Psr\Http\Message\ResponseInterface
|
2017-08-05 22:20:07 +00:00
|
|
|
*/
|
2018-01-06 00:27:47 +00:00
|
|
|
public function update(array $overrides = []): ResponseInterface
|
2017-08-05 22:20:07 +00:00
|
|
|
{
|
|
|
|
$node = $this->getNode();
|
|
|
|
$structure = [
|
|
|
|
'web' => [
|
|
|
|
'listen' => $node->daemonListen,
|
|
|
|
'ssl' => [
|
|
|
|
'enabled' => (! $node->behind_proxy && $node->scheme === 'https'),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'sftp' => [
|
|
|
|
'path' => $node->daemonBase,
|
|
|
|
'port' => $node->daemonSFTP,
|
|
|
|
],
|
|
|
|
'remote' => [
|
2018-02-04 18:55:50 +00:00
|
|
|
'base' => config('app.url'),
|
2017-08-05 22:20:07 +00:00
|
|
|
],
|
|
|
|
'uploads' => [
|
|
|
|
'size_limit' => $node->upload_size,
|
|
|
|
],
|
|
|
|
'keys' => [
|
|
|
|
$node->daemonSecret,
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
2017-10-01 02:00:24 +00:00
|
|
|
return $this->getHttpClient()->request('PATCH', 'config', [
|
2017-08-05 22:20:07 +00:00
|
|
|
'json' => array_merge($structure, $overrides),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|