Skip to content

Commit

Permalink
Fix config conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
addls committed Sep 20, 2020
1 parent 7bbcdf4 commit 0f91412
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "simple-swoole/simps",
"name": "thingspanel/simps",
"description": "A simple, lightweight and high-performance PHP coroutine framework.",
"type": "library",
"license": "Apache-2.0",
Expand Down Expand Up @@ -39,4 +39,4 @@
"scripts": {
"cs-fix": "php-cs-fixer fix $1"
}
}
}
2 changes: 1 addition & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static function run()
break;
default:
// 用户自定义server
$configs = config('servers', []);
$configs = simp_config('servers', []);
if (isset($configs[$command[0]], $configs[$command[0]]['class_name'])) {
$className = $configs[$command[0]]['class_name'];
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Http

public function __construct()
{
$config = config('servers');
$config = simp_config('servers');
$httpConfig = $config['http'];
$this->_config = $httpConfig;
if ($httpConfig['settings']['only_simple_http'] ?? false) {
Expand Down
2 changes: 1 addition & 1 deletion src/Server/MainServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class MainServer

public function __construct()
{
$config = config('servers', []);
$config = simp_config('servers', []);
$this->_config = $config['main'];
$this->_server = new $this->_config['class_name'](
$this->_config['ip'],
Expand Down
2 changes: 1 addition & 1 deletion src/Server/MqttServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MqttServer
*/
public function __construct()
{
$config = config('servers');
$config = simp_config('servers');
$mqttConfig = $config['mqtt'];
$this->_config = $mqttConfig;
$this->_server = new Server($mqttConfig['ip'], $mqttConfig['port'], $config['mode']);
Expand Down
2 changes: 1 addition & 1 deletion src/Server/WebSocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class WebSocket

public function __construct()
{
$config = config('servers');
$config = simp_config('servers');
$wsConfig = $config['ws'];
$this->_config = $wsConfig;
$this->_server = new Server($wsConfig['ip'], $wsConfig['port'], $config['mode']);
Expand Down
4 changes: 2 additions & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ function getInstance($class)
return ($class)::getInstance();
}
}
if (! function_exists('config')) {
function config($name, $default = null)
if (! function_exists('simp_config')) {
function simp_config($name, $default = null)
{
return getInstance('\Simps\Config')->get($name, $default);
}
Expand Down

0 comments on commit 0f91412

Please sign in to comment.