web.php 1.65 KB
Newer Older
Qiang Xue committed
1
<?php
2

3
$params = require(__DIR__ . '/params.php');
4

sensorario committed
5
$config = [
6 7
    'id' => 'basic',
    'basePath' => dirname(__DIR__),
8
    'bootstrap' => ['log'],
9
    'components' => [
10
        'request' => [
11
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
12
            'cookieValidationKey' => 'thisIsAKey',
13
        ],
14 15 16 17 18 19 20 21 22 23
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'user' => [
            'identityClass' => 'app\models\User',
            'enableAutoLogin' => true,
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
24
        'mailer' => [
25
            'class' => 'yii\swiftmailer\Mailer',
26 27 28
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
29 30 31 32 33 34 35 36 37 38 39
            'useFileTransport' => true,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
40
        'db' => require(__DIR__ . '/db.php'),
41 42 43 44
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
        ],
45 46
    ],
    'params' => $params,
sensorario committed
47
];
48

Qiang Xue committed
49
if (YII_ENV_DEV) {
50
    // configuration adjustments for 'dev' environment
51
    $config['bootstrap'][] = 'debug';
52
    $config['modules']['debug'] = 'yii\debug\Module';
53 54

    $config['bootstrap'][] = 'gii';
55
    $config['modules']['gii'] = 'yii\gii\Module';
56 57 58
}

return $config;