2013-05-24 22:14:49 +08:00
|
|
|
<?php
|
2024-03-05 13:32:12 +08:00
|
|
|
|
|
|
|
use yii\symfonymailer\Mailer;
|
|
|
|
|
2024-02-27 15:40:19 +08:00
|
|
|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
|
|
|
|
$dotenv->load();
|
2017-08-08 04:46:37 +08:00
|
|
|
$params = require __DIR__ . '/params.php';
|
|
|
|
$db = require __DIR__ . '/db.php';
|
2013-12-02 19:23:32 +08:00
|
|
|
|
2013-10-18 13:30:41 +08:00
|
|
|
$config = [
|
2014-03-16 12:46:16 +08:00
|
|
|
'id' => 'basic',
|
2024-03-30 13:43:33 +08:00
|
|
|
'name' => $_ENV['SITE_TITLE'],
|
2024-02-15 12:09:59 +08:00
|
|
|
// 'language' => 'zh-CN',
|
2014-03-16 12:46:16 +08:00
|
|
|
'basePath' => dirname(__DIR__),
|
2014-04-11 03:05:01 +08:00
|
|
|
'bootstrap' => ['log'],
|
2017-06-17 22:23:21 +08:00
|
|
|
'aliases' => [
|
|
|
|
'@bower' => '@vendor/bower-asset',
|
2024-02-09 12:15:09 +08:00
|
|
|
'@npm' => '@vendor/npm-asset',
|
2017-06-17 22:23:21 +08:00
|
|
|
],
|
2014-03-16 12:46:16 +08:00
|
|
|
'components' => [
|
2024-03-05 13:32:12 +08:00
|
|
|
'authManager' => [
|
|
|
|
'class' => 'yii\rbac\DbManager',
|
|
|
|
// uncomment if you want to cache RBAC items hierarchy
|
|
|
|
// 'cache' => 'cache',
|
|
|
|
],
|
2014-07-20 02:56:31 +08:00
|
|
|
'request' => [
|
2014-07-20 03:39:03 +08:00
|
|
|
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
|
2024-02-27 15:40:19 +08:00
|
|
|
'cookieValidationKey' => $_ENV['COOKIE_VALIDATION_KEY'],
|
2014-07-20 02:56:31 +08:00
|
|
|
],
|
2024-02-20 14:15:12 +08:00
|
|
|
// 'cache' => [
|
|
|
|
// 'class' => 'yii\caching\FileCache',
|
|
|
|
// ],
|
2014-03-16 12:46:16 +08:00
|
|
|
'cache' => [
|
2024-02-20 14:15:12 +08:00
|
|
|
'class' => 'yii\redis\Cache',
|
2014-03-16 12:46:16 +08:00
|
|
|
],
|
|
|
|
'user' => [
|
|
|
|
'identityClass' => 'app\models\User',
|
|
|
|
'enableAutoLogin' => true,
|
2024-02-10 17:41:07 +08:00
|
|
|
'loginUrl' => ['user/login'], // 登录地址
|
2014-03-16 12:46:16 +08:00
|
|
|
],
|
|
|
|
'errorHandler' => [
|
|
|
|
'errorAction' => 'site/error',
|
|
|
|
],
|
2014-06-26 22:28:28 +08:00
|
|
|
'mailer' => [
|
2024-03-05 13:32:12 +08:00
|
|
|
'class' => Mailer::class,
|
2022-06-18 00:15:52 +08:00
|
|
|
'viewPath' => '@app/mail',
|
|
|
|
// send all mails to a file by default.
|
2014-03-16 12:46:16 +08:00
|
|
|
'useFileTransport' => true,
|
|
|
|
],
|
|
|
|
'log' => [
|
|
|
|
'traceLevel' => YII_DEBUG ? 3 : 0,
|
|
|
|
'targets' => [
|
|
|
|
[
|
|
|
|
'class' => 'yii\log\FileTarget',
|
|
|
|
'levels' => ['error', 'warning'],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
2024-02-20 14:15:12 +08:00
|
|
|
'session' => [
|
|
|
|
'class' => 'yii\redis\Session',
|
|
|
|
],
|
|
|
|
'redis' => [
|
|
|
|
'class' => 'yii\redis\Connection',
|
2024-05-24 20:20:31 +08:00
|
|
|
'hostname' => $_ENV['RD_HOST'],
|
|
|
|
'port' => $_ENV['RD_PORT'],
|
2024-02-20 14:15:12 +08:00
|
|
|
'database' => 0,
|
|
|
|
],
|
2017-05-28 06:21:16 +08:00
|
|
|
'db' => $db,
|
2015-09-08 06:33:03 +08:00
|
|
|
/*
|
|
|
|
'urlManager' => [
|
|
|
|
'enablePrettyUrl' => true,
|
|
|
|
'showScriptName' => false,
|
|
|
|
'rules' => [
|
|
|
|
],
|
|
|
|
],
|
|
|
|
*/
|
2014-03-16 12:46:16 +08:00
|
|
|
],
|
|
|
|
'params' => $params,
|
2013-10-18 13:30:41 +08:00
|
|
|
];
|
2013-08-10 19:56:40 +08:00
|
|
|
|
2013-12-18 13:40:52 +08:00
|
|
|
if (YII_ENV_DEV) {
|
2014-03-16 12:46:16 +08:00
|
|
|
// configuration adjustments for 'dev' environment
|
2014-04-09 22:47:10 +08:00
|
|
|
$config['bootstrap'][] = 'debug';
|
2015-07-21 05:57:16 +08:00
|
|
|
$config['modules']['debug'] = [
|
|
|
|
'class' => 'yii\debug\Module',
|
2016-11-23 20:58:17 +08:00
|
|
|
// uncomment the following to add your IP if you are not connecting from localhost.
|
2024-03-30 13:43:33 +08:00
|
|
|
'allowedIPs' => ['127.0.0.1', '::1', '192.168.1.*'],
|
2015-07-21 05:57:16 +08:00
|
|
|
];
|
2014-04-18 08:42:50 +08:00
|
|
|
|
|
|
|
$config['bootstrap'][] = 'gii';
|
2015-07-21 05:57:16 +08:00
|
|
|
$config['modules']['gii'] = [
|
|
|
|
'class' => 'yii\gii\Module',
|
2016-11-23 20:58:17 +08:00
|
|
|
// uncomment the following to add your IP if you are not connecting from localhost.
|
2024-02-09 12:15:09 +08:00
|
|
|
'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
|
|
|
|
]
|
|
|
|
],
|
2015-07-21 05:57:16 +08:00
|
|
|
];
|
2013-08-10 19:56:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return $config;
|