yii2-netdisk/config/web.php
Chenx221 a4766198bb
*开发环境更新
PHP 8.2.17 -> PHP 8.3.4
*对php8.2应该还是兼容的,只不过你需要修改composer.json
2024-03-15 16:40:06 +08:00

107 lines
3.2 KiB
PHP

<?php
use yii\symfonymailer\Mailer;
$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' => [
'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' => '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','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;