예제 #1
0
 public static function create($pathname, $namespace = '')
 {
     static $paths = [];
     if (!static::$default) {
         $paths[$pathname] = $namespace;
         return new static($pathname, $namespace);
     } else {
         if (!isset($paths[$pathname])) {
             $paths[$pathname] = $namespace;
             static::$default->merge(new static($pathname, $namespace));
         }
     }
     return static::$default;
 }
예제 #2
0
 protected function register()
 {
     if ($fileConfig = FileConfig::getDefault()) {
         preg_match('/^(.*?)\\s*(|:\\s*(.*?))$/', $fileConfig->get('www.user', 'www-data:www-data'), $userMatch);
         $this->worker_user = $userMatch[1];
         $this->worker_user_group = $userMatch[3] ?? '';
     }
 }
예제 #3
0
 protected function register()
 {
     if ($fileConfig = FileConfig::getDefault()) {
         $this->pid_file_save_path = $fileConfig->get('daemon.pid', '/var/run/aurora.pid');
         $masterUser = Utils::getUserGroupFromColonStyle($fileConfig->get('daemon.user', 'nobody:nobody'));
         $this->master_user = $masterUser['user'];
         $this->master_user_group = $masterUser['group'];
         $workerUser = Utils::getUserGroupFromColonStyle($fileConfig->get('www.user', 'www-data:www-data'));
         $this->worker_user = $workerUser['user'];
         $this->worker_user_group = $workerUser['group'];
     }
 }
예제 #4
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->addConsoleOutputColors($output);
     /** @var \Aurora\Console\Application $app */
     $app = $this->getApplication();
     if (!($config = $app->getConfig())) {
         $configPath = $this->getAuroraConfigPath($input->getOption('config'));
         if (!is_file($configPath)) {
             throw new Exception("Could not find the configuration file: {$configPath}");
         }
         FileConfig::create($configPath);
         $config = new DaemonConfig();
     }
     $this->daemon = new Daemon($config);
 }
예제 #5
0
 public function merge(FileConfig $config)
 {
     $this->values = array_merge_recursive($this->values, $config->get());
 }