web.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. $params = require __DIR__ . '/params.php';
  3. $db = require __DIR__ . '/db.php';
  4. $config = [
  5. 'id' => 'basic',
  6. 'basePath' => dirname(__DIR__),
  7. 'bootstrap' => ['log'],
  8. 'aliases' => [
  9. '@bower' => '@vendor/bower-asset',
  10. '@npm' => '@vendor/npm-asset',
  11. ],
  12. 'components' => [
  13. 'request' => [
  14. 'cookieValidationKey' => 'MwDzyBzzBQMMA8d_tiCkX-h5oMhAg8jK',
  15. 'parsers' => [
  16. 'application/json' => 'yii\web\JsonParser',
  17. ],
  18. ],
  19. 'cache' => [
  20. 'class' => 'yii\caching\FileCache',
  21. ],
  22. 'user' => [
  23. 'identityClass' => 'app\models\User',
  24. 'enableAutoLogin' => true,
  25. ],
  26. 'errorHandler' => [
  27. 'errorAction' => 'site/error',
  28. ],
  29. 'mailer' => [
  30. 'class' => 'yii\swiftmailer\Mailer',
  31. // send all mails to a file by default. You have to set
  32. // 'useFileTransport' to false and configure transport
  33. // for the mailer to send real emails.
  34. 'useFileTransport' => true,
  35. ],
  36. 'log' => [
  37. 'traceLevel' => YII_DEBUG ? 3 : 0,
  38. 'targets' => [
  39. [
  40. 'class' => 'yii\log\FileTarget',
  41. 'levels' => ['error', 'warning'],
  42. ],
  43. ],
  44. ],
  45. 'db' => $db,
  46. 'urlManager' => [
  47. 'enablePrettyUrl' => true,
  48. 'showScriptName' => false,
  49. 'rules' => [
  50. [
  51. 'class' => 'common\rest\UrlRule',
  52. 'controller' => [
  53. 'v1/default',
  54. 'v1/dependencia',
  55. 'v1/evento',
  56. 'v1/grupo',
  57. 'v1/resultado',
  58. 'v1/usuario',
  59. 'v1/reporte-individual',
  60. 'v1/reporte-global'
  61. ],
  62. ]
  63. ],
  64. ],
  65. ],
  66. 'params' => $params,
  67. 'modules' => [
  68. 'v1' => ['class' => 'v1\Module'],
  69. ]
  70. ];
  71. if (YII_ENV_DEV) {
  72. // configuration adjustments for 'dev' environment
  73. $config['bootstrap'][] = 'debug';
  74. $config['modules']['debug'] = [
  75. 'class' => 'yii\debug\Module',
  76. // uncomment the following to add your IP if you are not connecting from localhost.
  77. //'allowedIPs' => ['127.0.0.1', '::1'],
  78. ];
  79. $config['bootstrap'][] = 'gii';
  80. $config['modules']['gii'] = [
  81. 'class' => 'yii\gii\Module',
  82. // uncomment the following to add your IP if you are not connecting from localhost.
  83. //'allowedIPs' => ['127.0.0.1', '::1'],
  84. ];
  85. }
  86. return $config;