-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.php
executable file
·84 lines (65 loc) · 2.26 KB
/
config.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
use Monolog\Logger;
use \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
//Constantes
define('FOLDER_FILES', __DIR__.'/files/');
define('FOLDER_BASE', __DIR__);
/**
* Config provider
*/
$app->register(
new GeckoPackages\Silex\Services\Config\ConfigServiceProvider(),
array(
'config.dir' => __DIR__,
'config.format' => 'config.yml',
'config.env' => 'prod'
)
);
$app->register(new \Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/src/views',
));
$app->register(new \Silex\Provider\HttpFragmentServiceProvider());
/**
* Database
*/
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
'db.options' => $app['config']['prd']['database']
));
/**
* Security
*/
$app->register(new \Silex\Provider\SessionServiceProvider(array('cookie_lifetime' => 0, 'name' => "_JDROLL_SESS", 'gc_maxlifetime' => 432000)));
$app['session.db_options'] = array(
'db_table' => 'session',
'db_id_col' => 'session_id',
'db_data_col' => 'session_value',
'db_time_col' => 'session_time',
);
$app['session.storage.handler'] = function () use ($app) {
return new Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler(
$app['db']->getWrappedConnection(),
$app['session.db_options'],
$app['session.storage.options']
);
};
/**
* General configuration
*/
$app["debug"] = $app['config']['prd']['general']['debug'];
$app->register(new \Silex\Provider\RoutingServiceProvider());
// Registers Swiftmailer extension
$app->register(new \Silex\Provider\SwiftmailerServiceProvider(), array());
$app['mailer'] = \Swift_Mailer::newInstance(\Swift_MailTransport::newInstance());
$app->register(new \Silex\Provider\HttpCacheServiceProvider(), array(
'http_cache.cache_dir' => __DIR__.'/cache/',
));
$app->register(new \Silex\Provider\MonologServiceProvider(), array(
'monolog.logfile' => __DIR__.'/development.log',
));
if($app['config']['prd']['log']['level'] == "ERROR") {
$app['monolog.level'] = Logger::ERROR;
} elseif($app['config']['prd']['log']['level'] == "INFO") {
$app['monolog.level'] = Logger::INFO;
} else {
$app['monolog.level'] = Logger::DEBUG;
}