common/config/base.php
<?php
/*
* This file is part of the HomeFinanceV2 project.
*
* (c) Rafalsky.com <http://github.com/Rafalsky/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$config = [
'name' => 'Home Finance',
'vendorPath' => dirname(dirname(__DIR__)).'/vendor',
'extensions' => require(__DIR__.'/../../vendor/yiisoft/extensions.php'),
'sourceLanguage' => 'en-US',
'language' => 'pl-PL',
'bootstrap' => ['log'],
'components' => [
'authManager' => [
'class' => \yii\rbac\DbManager::class,
'itemTable' => '{{%rbac_auth_item}}',
'itemChildTable' => '{{%rbac_auth_item_child}}',
'assignmentTable' => '{{%rbac_auth_assignment}}',
'ruleTable' => '{{%rbac_auth_rule}}'
],
'cache' => [
'class' => \yii\caching\FileCache::class,
'cachePath' => '@common/runtime/cache'
],
'commandBus' => [
'class' => \trntv\bus\CommandBus::class,
'middlewares' => [
[
'class' => \trntv\bus\middlewares\BackgroundCommandMiddleware::class,
'backgroundHandlerPath' => '@console/yii',
'backgroundHandlerRoute' => 'command-bus/handle',
]
]
],
'formatter' => [
'class' => \yii\i18n\Formatter::class
],
'glide' => [
'class' => \trntv\glide\components\Glide::class,
'sourcePath' => '@storage/web/source',
'cachePath' => '@storage/cache',
'urlManager' => 'urlManagerStorage',
'maxImageSize' => env('GLIDE_MAX_IMAGE_SIZE'),
'signKey' => env('GLIDE_SIGN_KEY')
],
'mailer' => [
'class' => \yii\swiftmailer\Mailer::class,
//'useFileTransport' => true,
'messageConfig' => [
'charset' => 'UTF-8',
'from' => env('ADMIN_EMAIL')
]
],
'db'=>[
'class' => \yii\db\Connection::class,
'dsn' => env('DB_DSN'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'tablePrefix' => env('DB_TABLE_PREFIX'),
'charset' => 'utf8',
'enableSchemaCache' => YII_ENV_PROD,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
'db' => [
'class' => \yii\log\DbTarget::class,
'levels' => ['error', 'warning'],
'except' => ['yii\web\HttpException:*', 'yii\i18n\I18N\*'],
'prefix' => function() {
$url = !\Yii::$app->request->isConsoleRequest ? \Yii::$app->request->getUrl() : null;
return sprintf('[%s][%s]', \Yii::$app->id, $url);
},
'logVars' => [],
'logTable' => '{{%system_log}}'
]
],
],
'i18n' => [
'translations' => [
'app'=>[
'class' => \yii\i18n\PhpMessageSource::class,
'basePath' => '@common/messages',
],
'*' => [
'class' => \yii\i18n\PhpMessageSource::class,
'basePath' => '@common/messages',
'fileMap' => [
'common' => 'common.php',
'backend' => 'backend.php',
'frontend' => 'frontend.php',
],
'on missingTranslation' => ['\backend\modules\i18n\Module', 'missingTranslation']
],
/* Uncomment this code to use DbMessageSource
'*'=> [
'class' => 'yii\i18n\DbMessageSource',
'sourceMessageTable' => '{{%i18n_source_message}}',
'messageTable' => '{{%i18n_message}}',
'enableCaching' => YII_ENV_DEV,
'cachingDuration' => 3600,
'on missingTranslation' => ['\backend\modules\i18n\Module', 'missingTranslation']
],
*/
],
],
'fileStorage' => [
'class' => \trntv\filekit\Storage::class,
'baseUrl' => '@storageUrl/source',
'filesystem' => [
'class' => \common\components\filesystem\LocalFlysystemBuilder::class,
'path' => '@storage/web/source'
],
'as log' => [
'class' => \common\behaviors\FileStorageLogBehavior::class,
'component' => 'fileStorage'
]
],
'keyStorage' => [
'class' => \common\components\keyStorage\KeyStorage::class
],
'urlManagerBackend' => \yii\helpers\ArrayHelper::merge(
[
'hostInfo' => \Yii::getAlias('@backendUrl')
],
require(\Yii::getAlias('@backend/config/_urlManager.php'))
),
'urlManagerFrontend' => \yii\helpers\ArrayHelper::merge(
[
'hostInfo' => \Yii::getAlias('@frontendUrl')
],
require(\Yii::getAlias('@frontend/config/_urlManager.php'))
),
'urlManagerStorage' => \yii\helpers\ArrayHelper::merge(
[
'hostInfo' => \Yii::getAlias('@storageUrl')
],
require(\Yii::getAlias('@storage/config/_urlManager.php'))
)
],
'params' => [
'adminEmail' => env('ADMIN_EMAIL'),
'robotEmail' => env('ROBOT_EMAIL'),
'availableLocales' => [
'pl-PL' => 'Polski (PL)',
'en-US' => 'English (US)',
//'ru-RU' => 'Русский (РФ)',
//'uk-UA' => 'Українська (Україна)',
//'es' => 'Español',
//'zh-CN' => '简体中文',
],
],
];
if (YII_ENV_PROD) {
$config['components']['log']['targets']['email'] = [
'class' => \yii\log\EmailTarget::class,
'except' => ['yii\web\HttpException:*'],
'levels' => ['error', 'warning'],
'message' => ['from' => env('ROBOT_EMAIL'), 'to' => env('ADMIN_EMAIL')]
];
}
if (YII_ENV_DEV) {
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => \yii\gii\Module::class
];
$config['components']['cache'] = [
'class' => \yii\caching\DummyCache::class
];
$config['components']['mailer']['transport'] = [
'class' => \Swift_SmtpTransport::class,
'host' => env('SMTP_HOST'),
'port' => env('SMTP_PORT'),
];
}
return $config;