web.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. ],
  61. ]
  62. ],
  63. ],
  64. ],
  65. 'params' => $params,
  66. 'modules' => [
  67. 'v1' => ['class' => 'v1\Module'],
  68. ]
  69. ];
  70. if (YII_ENV_DEV) {
  71. // configuration adjustments for 'dev' environment
  72. $config['bootstrap'][] = 'debug';
  73. $config['modules']['debug'] = [
  74. 'class' => 'yii\debug\Module',
  75. // uncomment the following to add your IP if you are not connecting from localhost.
  76. //'allowedIPs' => ['127.0.0.1', '::1'],
  77. ];
  78. $config['bootstrap'][] = 'gii';
  79. $config['modules']['gii'] = [
  80. 'class' => 'yii\gii\Module',
  81. // uncomment the following to add your IP if you are not connecting from localhost.
  82. //'allowedIPs' => ['127.0.0.1', '::1'],
  83. ];
  84. }
  85. return $config;