Exemple #1
0
 /**
  * Apply settings to the Slim application.
  *
  * @param \Slim\Slim $slim Application
  */
 protected function configureSlim(\Slim\Slim $slim)
 {
     $slim->config(['parsoid.url' => Config::getStr('PARSOID_URL', 'http://parsoid-lb.eqiad.wikimedia.org/enwiki/'), 'parsoid.cache' => Config::getStr('CACHE_DIR', "{$this->deployDir}/data/cache"), 'es.url' => Config::getStr('ES_URL', 'http://127.0.0.1:9200/')]);
     $slim->configureMode('production', function () use($slim) {
         $slim->config(['debug' => false, 'log.level' => Config::getStr('LOG_LEVEL', 'INFO')]);
         // Install a custom error handler
         $slim->error(function (\Exception $e) use($slim) {
             $errorId = substr(session_id(), 0, 8) . '-' . substr(uniqid(), -8);
             $slim->log->critical($e->getMessage(), ['exception' => $e, 'errorId' => $errorId]);
             $slim->view->set('errorId', $errorId);
             $slim->render('error.html');
         });
     });
     $slim->configureMode('development', function () use($slim) {
         $slim->config(['debug' => true, 'log.level' => Config::getStr('LOG_LEVEL', 'DEBUG'), 'view.cache' => false]);
     });
 }
Exemple #2
0
 /**
  * Apply settings to the Slim application.
  *
  * @param \Slim\Slim $slim Application
  */
 protected function configureSlim(\Slim\Slim $slim)
 {
     $slim->config(array('parsoid.url' => Config::getStr('PARSOID_URL', 'http://parsoid-lb.eqiad.wikimedia.org/enwiki/'), 'parsoid.cache' => Config::getStr('CACHE_DIR', "{$this->deployDir}/data/cache"), 'es.url' => Config::getStr('ES_URL', 'http://127.0.0.1:9200/'), 'es.user' => Config::getStr('ES_USER', ''), 'es.password' => Config::getStr('ES_PASSWORD', ''), 'can.edit' => Config::getBool('CAN_EDIT', false), 'can.vote' => Config::getBool('CAN_VOTE', false), 'oauth.enable' => Config::getBool('USE_OAUTH', false), 'oauth.consumer_token' => Config::getStr('OAUTH_CONSUMER_TOKEN', ''), 'oauth.secret_token' => Config::getStr('OAUTH_SECRET_TOKEN', ''), 'oauth.endpoint' => Config::getStr('OAUTH_ENDPOINT', ''), 'oauth.redir' => Config::getStr('OAUTH_REDIR', ''), 'oauth.callback' => Config::getStr('OAUTH_CALLBACK', '')));
     $slim->configureMode('production', function () use($slim) {
         $slim->config(array('debug' => false, 'log.level' => Config::getStr('LOG_LEVEL', 'INFO')));
         // Install a custom error handler
         $slim->error(function (\Exception $e) use($slim) {
             $errorId = substr(session_id(), 0, 8) . '-' . substr(uniqid(), -8);
             $slim->log->critical($e->getMessage(), array('exception' => $e, 'errorId' => $errorId));
             $slim->view->set('errorId', $errorId);
             $slim->render('error.html');
         });
     });
     $slim->configureMode('development', function () use($slim) {
         $slim->config(array('debug' => true, 'log.level' => Config::getStr('LOG_LEVEL', 'DEBUG'), 'view.cache' => false));
     });
 }