Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/Vinelab/Minion/Console/Commands/RunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ class RunCommand extends Command
*
* @var array
*
* @since 1.3.0
* @since 1.3.3
*/
protected $options = array(
'realm',
'host',
'port',
'register',
'debug',
'tls',
'path',
);

/**
Expand Down Expand Up @@ -75,6 +77,14 @@ public function fire()
$options['debug'] = true;
}

if ($this->option('tls')) {
$options['tls'] = true;
}

if ($this->option('path')) {
$options['path'] = $this->option('path');
}

$m = new Minion();

if ($this->option('register')) {
Expand Down Expand Up @@ -103,6 +113,8 @@ public function getOptions()
['realm', null, InputOption::VALUE_OPTIONAL, 'Specify WAMP realm to be used'],
['host', null, InputOption::VALUE_OPTIONAL, 'Specify the router host'],
['port', null, InputOption::VALUE_OPTIONAL, 'Specify the router port'],
['tls', null, InputOption::VALUE_NONE, 'Specify the router protocol as wss'],
['path', null, InputOption::VALUE_OPTIONAL, 'Specify the router path component'],
['register', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Register provider classes'],
['debug', null, InputOption::VALUE_NONE, 'Run in debug mode outputting all trasport messages.'],
];
Expand Down
20 changes: 20 additions & 0 deletions src/config/minion.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,24 @@

'debug' => false,

/*
|--------------------------------------------------------------------------
| Transport Layer Security
|--------------------------------------------------------------------------
|
| Toggle between ws/wss protocol
|
*/
'tls' => false,

/*
|--------------------------------------------------------------------------
| URL path component
|--------------------------------------------------------------------------
|
| Will be appended to the transport URL as the path component
|
*/
'path' => '/ws',

];
15 changes: 15 additions & 0 deletions tests/unit/MinionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ public function test_merging_config()
$this->m->mergeConfig($options);
$this->assertEquals($merged, $this->m->getConfig());
}

public function test_config_tls()
{
$this->assertEquals(false, $this->m->getConfig('tls'));
$this->m->mergeConfig(['tls'=>true]);
$this->assertEquals(true, $this->m->getConfig('tls'));
}

public function test_config_path()
{
$path = '/websocket';
$this->assertEquals('/ws', $this->m->getConfig('path'));
$this->m->mergeConfig(['path'=>$path]);
$this->assertEquals($path, $this->m->getConfig('path'));
}
}

class NonProvider
Expand Down