Skip to content

Commit

Permalink
swoole settings
Browse files Browse the repository at this point in the history
  • Loading branch information
XieBiao committed Jan 20, 2018
1 parent 15f38cc commit 69a2967
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ composer require "hhxsv5/laravel-s:~1.0" -vvv

```PHP
//run in console!
$svrConf = ['ip' => '0.0.0.0', 'port' => 8011];
$svrConf = ['ip' => '0.0.0.0', 'port' => 8011, 'settings' => [/*swoole settings*/]];
$laravelConf = ['rootPath' => base_path()];
$s = \Hhxsv5\LaravelS\LaravelS::getInstance($svrConf, $laravelConf);
$s->run();
Expand Down
5 changes: 3 additions & 2 deletions src/Swoole/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ public function __construct(array $svrConf = [], Laravel $laravel)
$ip = isset($svrConf['ip']) ? $svrConf['ip'] : '0.0.0.0';
$port = isset($svrConf['port']) ? $svrConf['port'] : 8841;

if (isset($svrConf['ssl_cert_file'], $svrConf['ssl_key_file'])) {
$settings = isset($svrConf['settings']) ? $svrConf['settings'] : [];

if (isset($settings['ssl_cert_file'], $settings['ssl_key_file'])) {
$this->sw = new \swoole_http_server($ip, $port, SWOOLE_PROCESS, SWOOLE_SOCK_TCP | SWOOLE_SSL);
} else {
$this->sw = new \swoole_http_server($ip, $port, SWOOLE_PROCESS);
}

$settings = isset($svrConf['settings']) ? $svrConf['settings'] : [];
$this->sw->set($settings);

$this->laravel = $laravel;
Expand Down

0 comments on commit 69a2967

Please sign in to comment.