Exemplo n.º 1
0
Arquivo: App.php Projeto: bd808/quips
 /**
  * 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));
     });
 }
Exemplo n.º 2
0
Arquivo: App.php Projeto: bd808/SAL
 /**
  * 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]);
     });
 }
Exemplo n.º 3
0
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
namespace Bd808\Bash;

if (!defined('APP_ROOT')) {
    define('APP_ROOT', dirname(__DIR__));
}
require_once APP_ROOT . '/vendor/autoload.php';
// Ensure that a default timezone is set
set_error_handler(function ($errno, $errstr) {
    throw new Exception($errstr);
});
try {
    date_default_timezone_get();
} catch (Exception $e) {
    // Use UTC if not specified anywhere in .ini
    date_default_timezone_set('UTC');
}
restore_error_handler();
// Load environment settings from .env if present
if (is_readable(APP_ROOT . '/.env')) {
    \Wikimedia\Slimapp\Config::load(APP_ROOT . '/.env');
}
$app = new App(APP_ROOT);
$app->run();