99 lines
3.0 KiB
PHP
99 lines
3.0 KiB
PHP
<?php
|
|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
|
|
$dotenv->load();
|
|
$params = require __DIR__ . '/params.php';
|
|
$db = require __DIR__ . '/db.php';
|
|
|
|
$config = [
|
|
'id' => 'basic',
|
|
'name' =>'网盘',
|
|
// 'language' => 'zh-CN',
|
|
'basePath' => dirname(__DIR__),
|
|
'bootstrap' => ['log'],
|
|
'aliases' => [
|
|
'@bower' => '@vendor/bower-asset',
|
|
'@npm' => '@vendor/npm-asset',
|
|
],
|
|
'components' => [
|
|
'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' => \yii\symfonymailer\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' => 'localhost',
|
|
'port' => 6379,
|
|
'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'],
|
|
];
|
|
|
|
$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;
|