2017-08-05 22:20:07 +00:00
|
|
|
<?php
|
2017-09-26 02:43:01 +00:00
|
|
|
/**
|
2017-08-05 22:20:07 +00:00
|
|
|
* Pterodactyl - Panel
|
|
|
|
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
|
|
|
*
|
2017-09-26 02:43:01 +00:00
|
|
|
* This software is licensed under the terms of the MIT license.
|
|
|
|
* https://opensource.org/licenses/MIT
|
2017-08-05 22:20:07 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Pterodactyl\Repositories\Daemon;
|
|
|
|
|
|
|
|
use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;
|
|
|
|
|
|
|
|
class ConfigurationRepository extends BaseRepository implements ConfigurationRepositoryInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function update(array $overrides = [])
|
|
|
|
{
|
|
|
|
$node = $this->getNode();
|
|
|
|
$structure = [
|
|
|
|
'web' => [
|
|
|
|
'listen' => $node->daemonListen,
|
|
|
|
'ssl' => [
|
|
|
|
'enabled' => (! $node->behind_proxy && $node->scheme === 'https'),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'sftp' => [
|
|
|
|
'path' => $node->daemonBase,
|
|
|
|
'port' => $node->daemonSFTP,
|
|
|
|
],
|
|
|
|
'remote' => [
|
|
|
|
'base' => $this->config->get('app.url'),
|
|
|
|
],
|
|
|
|
'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),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|