load(); $params = require __DIR__ . '/params.php'; $db = require __DIR__ . '/db.php'; $config = [ 'id' => 'basic', 'name' => $_ENV['SITE_TITLE'], // 'language' => 'zh-CN', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'aliases' => [ '@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset', ], 'components' => [ 'authManager' => [ 'class' => 'yii\rbac\DbManager', // uncomment if you want to cache RBAC items hierarchy 'cache' => 'cache', ], 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => $_ENV['COOKIE_VALIDATION_KEY'], ], // 'cache' => [ // 'class' => 'yii\caching\FileCache', // ], 'cache' => [ 'class' => 'yii\redis\Cache', ], 'user' => [ 'identityClass' => 'app\models\User', 'enableAutoLogin' => true, 'loginUrl' => ['user/login'], // 登录地址 ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'mailer' => [ 'class' => Mailer::class, 'viewPath' => '@app/mail', // send all mails to a file by default. 'useFileTransport' => true, ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], ], ], 'session' => [ 'class' => 'yii\redis\Session', ], 'redis' => [ 'class' => 'yii\redis\Connection', 'hostname' => $_ENV['RD_HOST'], 'port' => $_ENV['RD_PORT'], 'database' => 0, ], 'db' => $db, /* 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ ], ], */ ], 'params' => $params, ]; if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => 'yii\debug\Module', // uncomment the following to add your IP if you are not connecting from localhost. 'allowedIPs' => ['127.0.0.1', '::1', '192.168.1.*'], ]; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', // uncomment the following to add your IP if you are not connecting from localhost. 'allowedIPs' => ['127.0.0.1', '::1', '192.168.1.*'], 'generators' => [ //自定义生成器 'rest-model' => [ // generator name 'class' => 'bestyii\giiRest\generators\model\Generator', // generator class ], 'rest-crud' => [ // generator name 'class' => 'bestyii\giiRest\generators\crud\Generator', // generator class ] ], ]; } return $config;