You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.7 KiB

  1. <?php
  2. $params = array_merge(
  3. require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php'
  4. );
  5. return [
  6. 'id' => 'api',
  7. 'basePath' => dirname(__DIR__),
  8. 'controllerNamespace' => 'api\controllers',
  9. 'bootstrap' => ['log'],
  10. 'modules' => [],
  11. 'components' => [
  12. 'request' => [
  13. 'parsers' => [
  14. 'application/json' => 'yii\web\JsonParser',
  15. ],
  16. 'csrfParam' => '_csrf-api',
  17. ],
  18. 'session' => [
  19. // this is the name of the session cookie used for login on the app
  20. 'name' => 'api',
  21. ],
  22. 'log' => [
  23. 'traceLevel' => YII_DEBUG ? 3 : 0,
  24. 'targets' => [
  25. [
  26. 'class' => 'yii\log\FileTarget',
  27. 'levels' => ['error', 'warning'],
  28. ],
  29. ],
  30. ],
  31. 'user' => [
  32. 'identityClass' => 'common\models\User',
  33. 'enableAutoLogin' => true,
  34. 'identityCookie' => ['name' => '_identity-api', 'httpOnly' => true],
  35. ],
  36. 'errorHandler' => [
  37. 'errorAction' => 'site/error',
  38. ],
  39. 'urlManager' => [
  40. 'enablePrettyUrl' => true,
  41. 'enableStrictParsing' => true,
  42. 'showScriptName' => false,
  43. 'rules' => [
  44. ['class' => 'yii\rest\UrlRule',
  45. 'controller' => 'user',
  46. 'extraPatterns' => [
  47. 'GET menu' => 'menu',
  48. 'GET create' => 'create'
  49. ]
  50. ],
  51. ],
  52. ],
  53. ],
  54. 'params' => $params,
  55. ];