Exemple #1
0
require __DIR__ . '/../debug.php';
$app['logger.search'] = $app->share(function ($app) {
    $logger = new \Monolog\Logger('search');
    $handlers = $app['config']['log.search'];
    foreach ($handlers as $handler_config) {
        switch ($handler_config['type']) {
            case 'hipchat':
                $handler = new \Monolog\Handler\HipChatHandler($handler_config['token'], $handler_config['room']);
                break;
            case 'file':
                $handler = new \Monolog\Handler\StreamHandler(__DIR__ . '/' . $handler_config['path']);
                break;
            default:
                continue 2;
        }
        $handler->setLevel($handler_config['level']);
        $logger->pushHandler($handler);
    }
    return $logger;
});
// Enable CORS.
$app->after($app["cors"]);
if (isset($app['config']['cdbxml_proxy']) && $app['config']['cdbxml_proxy']['enabled']) {
    $app->before(function (Request $request, Application $app) {
        /** @var \CultuurNet\UDB3\Symfony\Proxy\CdbXmlProxy $cdbXmlProxy */
        $cdbXmlProxy = $app['cdbxml_proxy'];
        return $cdbXmlProxy->handle($request);
    }, Application::EARLY_EVENT);
}
/**
 * Bootstrap metadata based on user context.