|
|
@@ -2,8 +2,8 @@
|
|
|
namespace WORKERMAN\Core\Lib;
|
|
|
class Config
|
|
|
{
|
|
|
- public $filename;
|
|
|
- public $config = array();
|
|
|
+ public static $filename;
|
|
|
+ public static $config = array();
|
|
|
protected static $instances = null;
|
|
|
|
|
|
private function __construct()
|
|
|
@@ -13,16 +13,16 @@ class Config
|
|
|
{
|
|
|
throw new \Exception('Configuration file "' . $config_file . '" not found');
|
|
|
}
|
|
|
- $this->config['workerman'] = $this->parseFile($config_file);
|
|
|
- $this->filename = realpath($config_file);
|
|
|
+ self::$config['workerman'] = self::parseFile($config_file);
|
|
|
+ self::$filename = realpath($config_file);
|
|
|
foreach(glob(WORKERMAN_ROOT_DIR . 'conf.d/*.conf') as $config_file)
|
|
|
{
|
|
|
$worker_name = basename($config_file, '.conf');
|
|
|
- $this->config[$worker_name] = $this->parseFile($config_file);
|
|
|
+ self::$config[$worker_name] = self::parseFile($config_file);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- protected function parseFile($config_file)
|
|
|
+ protected static function parseFile($config_file)
|
|
|
{
|
|
|
$config = parse_ini_file($config_file, true);
|
|
|
if (!is_array($config) || empty($config))
|
|
|
@@ -57,7 +57,7 @@ class Config
|
|
|
|
|
|
public static function getAllWorkers()
|
|
|
{
|
|
|
- $copy = $this->config;
|
|
|
+ $copy = self::$config;
|
|
|
unset($copy['workerman']);
|
|
|
return $copy;
|
|
|
}
|