-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathapp.php
33 lines (27 loc) · 996 Bytes
/
app.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require_once __DIR__.'/vendor/autoload.php';
$app = new Silex\Application();
// set up Monolog to log to stderr
$app->register(new Silex\Provider\MonologServiceProvider(), [
'monolog.logfile' => 'php://stderr',
'monolog.level' => constant('Monolog\\Logger::'.strtoupper(getenv('LOG_LEVEL')?:'NOTICE')),
]);
// RabbitMQ connection
$rabbitmq = parse_url(getenv('CLOUDAMQP_URL'));
$app->register(new Amqp\Silex\Provider\AmqpServiceProvider, [
'amqp.connections' => [
'default' => [
'host' => $rabbitmq['host'],
'port' => isset($rabbitmq['port']) ? $rabbitmq['port'] : 5672,
'username' => $rabbitmq['user'],
'password' => $rabbitmq['pass'],
'vhost' => substr($rabbitmq['path'], 1) ?: '/',
],
],
]);
// Redis database
$app->register(new Predis\Silex\ClientServiceProvider(), [
'predis.parameters' => getenv('REDIS_URL'),
]);
// return app object for use by other files
return $app;