Add ability to mark a node as being over a proxy

This commit is contained in:
Dane Everitt 2017-04-27 22:52:37 -04:00
parent 801aae968c
commit 3ee7b7cff1
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 86 additions and 21 deletions

View file

@ -88,7 +88,7 @@ class NodesController extends Controller
]),
$request->intersect([
'name', 'location_id', 'fqdn',
'scheme', 'memory', 'disk',
'scheme', 'memory', 'disk', 'behind_proxy',
'daemonBase', 'daemonSFTP', 'daemonListen',
])
));
@ -218,7 +218,7 @@ class NodesController extends Controller
'public', 'disk_overallocate', 'memory_overallocate',
]),
$request->intersect([
'name', 'location_id', 'fqdn',
'name', 'location_id', 'fqdn', 'behind_proxy',
'scheme', 'memory', 'disk', 'upload_size',
'reset_secret', 'daemonSFTP', 'daemonListen',
])

View file

@ -59,6 +59,7 @@ class Node extends Model
'disk' => 'integer',
'daemonListen' => 'integer',
'daemonSFTP' => 'integer',
'behind_proxy' => 'boolean',
];
/**
@ -68,8 +69,8 @@ class Node extends Model
*/
protected $fillable = [
'public', 'name', 'location_id',
'fqdn', 'scheme', 'memory',
'memory_overallocate', 'disk',
'fqdn', 'scheme', 'behind_proxy',
'memory', 'memory_overallocate', 'disk',
'disk_overallocate', 'upload_size',
'daemonSecret', 'daemonBase',
'daemonSFTP', 'daemonListen',
@ -121,7 +122,7 @@ class Node extends Model
'host' => '0.0.0.0',
'listen' => $this->daemonListen,
'ssl' => [
'enabled' => $this->scheme === 'https',
'enabled' => (! $this->behind_proxy && $this->scheme === 'https'),
'certificate' => '/etc/letsencrypt/live/' . $this->fqdn . '/fullchain.pem',
'key' => '/etc/letsencrypt/live/' . $this->fqdn . '/privkey.pem',
],
@ -143,7 +144,7 @@ class Node extends Model
'count' => 3,
],
'remote' => [
'base' => config('app.url'),
'base' => route('index'),
'download' => route('remote.download'),
'installed' => route('remote.install'),
],

View file

@ -52,6 +52,7 @@ class NodeRepository
'public' => 'required|numeric|between:0,1',
'fqdn' => 'required|string|unique:nodes,fqdn',
'scheme' => 'required|regex:/^(http(s)?)$/',
'behind_proxy' => 'required|boolean',
'memory' => 'required|numeric|min:1',
'memory_overallocate' => 'required|numeric|min:-1',
'disk' => 'required|numeric|min:1',
@ -109,6 +110,7 @@ class NodeRepository
'public' => 'numeric|between:0,1',
'fqdn' => 'string|unique:nodes,fqdn,' . $id,
'scheme' => 'regex:/^(http(s)?)$/',
'behind_proxy' => 'boolean',
'memory' => 'numeric|min:1',
'memory_overallocate' => 'numeric|min:-1',
'disk' => 'numeric|min:1',
@ -166,7 +168,7 @@ class NodeRepository
'web' => [
'listen' => $node->daemonListen,
'ssl' => [
'enabled' => ($node->scheme === 'https'),
'enabled' => (! $node->behind_proxy && $node->scheme === 'https'),
],
],
'sftp' => [