appserver.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /**
  3. * FecShop file.
  4. *
  5. * @link http://www.fecshop.com/
  6. * @copyright Copyright (c) 2016 FecShop Software LLC
  7. * @license http://www.fecshop.com/license/
  8. */
  9. // 本文件在app/web/index.php 处引入。
  10. // fecshop - appfront 的核心模块
  11. $modules = [];
  12. foreach (glob(__DIR__ . '/modules/*.php') as $filename) {
  13. $modules = array_merge($modules, require($filename));
  14. }
  15. // 此处也可以重写fecshop的组件。供调用。
  16. $config = [
  17. 'modules'=>$modules,
  18. /* only config in front web */
  19. 'bootstrap' => ['store'],
  20. 'params' => [
  21. /* appfront base theme dir */
  22. //'appfrontBaseTheme' => '@fecshop/app/appfront/theme/base/front',
  23. //'appfrontBaseLayoutName'=> 'main.php',
  24. 'appName' => 'appserver',
  25. // 速度控制[120,60] 代表 60秒内最大访问120次,
  26. //'rateLimit' => [
  27. // 'enable'=> false, # 是否开启?默认不开启速度控制。
  28. // 'limit' => [120, 60],
  29. //]
  30. ],
  31. // language config.
  32. 'components' => [
  33. 'i18n' => [
  34. 'translations' => [
  35. 'appserver' => [
  36. //'class' => 'yii\i18n\PhpMessageSource',
  37. 'class' => 'fecshop\yii\i18n\PhpMessageSource',
  38. 'basePaths' => [
  39. '@fecshop/app/appserver/languages',
  40. ],
  41. 'sourceLanguage' => 'en_US', // 如果 en_US 也想翻译,那么可以改成en_XX。
  42. ],
  43. ],
  44. ],
  45. 'user' => [
  46. // 'class' => 'fecshop\yii\web\User',
  47. // 【默认】不开启速度限制的 User Model
  48. 'identityClass' => 'fecshop\models\mysqldb\Customer',
  49. // 开启速度限制的 User Model
  50. // 'identityClass' => 'fecshop\models\mysqldb\customer\CustomerAccessToken',
  51. // 关闭session
  52. 'enableSession' => false,
  53. ],
  54. 'urlManager' => [
  55. 'rules' => [
  56. '' => 'cms/home/index',
  57. ],
  58. ],
  59. 'request' => [
  60. 'class' => 'yii\web\Request',
  61. /*
  62. 'enableCookieValidation' => true,
  63. 'enableCsrfValidation' => true,
  64. 'cookieValidationKey' => 'O1d232trde1x-M97_7QvwPo-5QGdkLMp#@#@',
  65. 'noCsrfRoutes' => [
  66. 'catalog/product/addreview',
  67. 'favorite/product/remark',
  68. 'paypal/ipn/index',
  69. 'paypal/ipn',
  70. ],
  71. */
  72. ],
  73. ],
  74. ];
  75. // product 生产环境,errorHandler使用 AppserverErrorHandler
  76. if (YII_ENV_PROD) {
  77. $config['components']['errorHandler']['class'] = 'fecshop\components\AppserverErrorHandler';
  78. }
  79. return $config;