public function __construct($options = array()) { $this->configureErrorHandler(); // configure $mergedOptions = ['env' => isset($_SERVER['ENV']) ? $_SERVER['ENV'] : 'development', 'config.path' => '../config', 'date.timezone' => 'UTC', 'route.dispatcher' => 'simple', 'response.chunkSize' => 4096]; $optionsPath = isset($options['config.path']) ? $options['config.path'] : $mergedOptions['config.path']; $mergedOptions = Options::create($mergedOptions, $mergedOptions['env'])->mergeFile($optionsPath . '/config.php')->merge($options)->toArray(); parent::__construct($mergedOptions); }
public function __construct(array $options = []) { $options = App::getInstance()['nginx'] ?: []; parent::__construct($options); $this->routeMap(['GET'], '/', [$this, 'search']); $this->routeMap(['POST'], '/', [$this, 'create']); $this->routeMap(['DELETE'], '/', [$this, 'delete']); $this->routeMap(['GET'], '/reload', [$this, 'reload']); $this->routeMap(['POST'], '/{normalized}/upstream', [$this, 'upstreamCreate']); $this->routeMap(['DELETE'], '/{normalized}/upstream', [$this, 'upstreamDelete']); }