80 lines
2.5 KiB
PHP
80 lines
2.5 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
use yii\web\Request;
|
||
|
|
|
||
|
|
$params = array_merge(
|
||
|
|
require __DIR__ . '/../../common/config/params.php',
|
||
|
|
require __DIR__ . '/../../common/config/params-local.php',
|
||
|
|
require __DIR__ . '/params.php',
|
||
|
|
require __DIR__ . '/params-local.php'
|
||
|
|
);
|
||
|
|
$baseUrl = str_replace('/frontend/web', '', (new Request)->getBaseUrl());
|
||
|
|
|
||
|
|
return [
|
||
|
|
'id' => 'bon-frontend',
|
||
|
|
'basePath' => dirname(__DIR__),
|
||
|
|
'bootstrap' => ['log'],
|
||
|
|
'timeZone' => 'Asia/Bangkok',
|
||
|
|
'controllerNamespace' => 'frontend\controllers',
|
||
|
|
'modules' => [],
|
||
|
|
'components' => [
|
||
|
|
'request' => [
|
||
|
|
'csrfParam' => '_csrf-frontend',
|
||
|
|
'baseUrl' => $baseUrl,
|
||
|
|
'cookieValidationKey' => 'CHANGE_ME_TO_RANDOM_STRING',
|
||
|
|
],
|
||
|
|
'user' => [
|
||
|
|
'identityClass' => 'common\models\User',
|
||
|
|
'enableAutoLogin' => true,
|
||
|
|
'identityCookie' => ['name' => '_identity-bon-frontend', 'httpOnly' => true],
|
||
|
|
],
|
||
|
|
'session' => [
|
||
|
|
// this is the name of the session cookie used for login on the frontend
|
||
|
|
'name' => 'bon-frontend',
|
||
|
|
'cookieParams' => ['httponly' => true, 'lifetime' => 60],
|
||
|
|
'timeout' => 60, //session expire
|
||
|
|
'useCookies' => true,
|
||
|
|
],
|
||
|
|
'log' => [
|
||
|
|
'traceLevel' => YII_DEBUG ? 3 : 0,
|
||
|
|
'targets' => [
|
||
|
|
[
|
||
|
|
'class' => 'yii\log\FileTarget',
|
||
|
|
'levels' => ['error', 'warning'],
|
||
|
|
],
|
||
|
|
],
|
||
|
|
],
|
||
|
|
'errorHandler' => [
|
||
|
|
'errorAction' => 'site/error',
|
||
|
|
],
|
||
|
|
'formatter' => [
|
||
|
|
'class' => 'yii\i18n\Formatter',
|
||
|
|
'defaultTimeZone' => 'Asia/Bangkok',
|
||
|
|
'timeZone' => 'Asia/Bangkok',
|
||
|
|
],
|
||
|
|
|
||
|
|
'urlManager' => [
|
||
|
|
'baseUrl' => $baseUrl,
|
||
|
|
'enablePrettyUrl' => true,
|
||
|
|
'showScriptName' => false,
|
||
|
|
//'suffix' => '.html',
|
||
|
|
'rules' => [
|
||
|
|
'post/index/<slug>/<id:\d+>' => 'post/index',
|
||
|
|
'post/view/<slug>/<id:\d+>' => 'post/view',
|
||
|
|
'page/view/<slug>/<id:\d+>' => 'page/view',
|
||
|
|
'page/view/<id:\d+>' => 'page/view',
|
||
|
|
],
|
||
|
|
],
|
||
|
|
'view' => [
|
||
|
|
'theme' => [
|
||
|
|
'pathMap' => [
|
||
|
|
'@app/views' => '@frontend/themes/mali/views'
|
||
|
|
]
|
||
|
|
]
|
||
|
|
],
|
||
|
|
'meta' => [
|
||
|
|
'class' => 'frontend\components\MetaComponent',
|
||
|
|
],
|
||
|
|
],
|
||
|
|
'params' => $params,
|
||
|
|
];
|