config.local.example.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * api-test 本机配置模板。复制成 config.local.php 再填(已 gitignore,不要提交):
  4. *
  5. * cp config.local.example.php config.local.php
  6. *
  7. * 切 server 两种方式(账号 / 种子数据都会跟着走):
  8. * 1. 改 `$server` 默认值;
  9. * 2. `php run.php --server=<alias>` 临时切,alias 见 config.php 的 servers 列表。
  10. * 每个 server 一套账号 + 种子数据,集中列在 `$servers`,互不干扰。
  11. * 优先级:命令行参数 > 环境变量(API_TEST_*)> 本文件 > config.php 默认值。
  12. * 不需要的键删掉或留 null 即可。
  13. */
  14. $server = 'local'; // local | staging | next | prod | next-cn | prod-cn
  15. $servers = [
  16. 'local' => [
  17. 'username' => 'test',
  18. 'password' => null,
  19. 'token' => null, // 填了就直接用,跳过登录
  20. 'fixtures' => [
  21. // 讨论写用例挂的句子:必须在测试账号自己的 channel 里、由测试账号编辑过
  22. // 'discussion_sentence' => 'ee5259be-5d1e-4408-a2a6-566a5773eef1',
  23. // discussion_sentence 所在的 channel(agent 授权的范围)
  24. // 'discussion_channel' => '1721b7fa-e471-46fd-b860-64b9e79d370e',
  25. // agent 代写用例:归测试账号所有的 AI 模型 uid;不给则 SKIP
  26. // 'agent_model' => null,
  27. // email-certifications「已注册邮箱」用例;不给则 SKIP
  28. // 'registered_email' => 'someone@example.com',
  29. ],
  30. ],
  31. 'staging' => [
  32. 'username' => null,
  33. 'password' => null,
  34. 'token' => null,
  35. 'fixtures' => [
  36. // 'discussion_sentence' => '',
  37. // 'discussion_channel' => '',
  38. // 'agent_model' => null,
  39. // 'registered_email' => null,
  40. ],
  41. ],
  42. 'next' => [
  43. 'username' => null,
  44. 'password' => null,
  45. 'token' => null,
  46. 'fixtures' => [],
  47. ],
  48. 'prod' => [
  49. 'username' => null,
  50. 'password' => null,
  51. 'token' => null,
  52. 'fixtures' => [],
  53. ],
  54. 'next-cn' => [
  55. 'username' => null,
  56. 'password' => null,
  57. 'token' => null,
  58. 'fixtures' => [],
  59. ],
  60. 'prod-cn' => [
  61. 'username' => null,
  62. 'password' => null,
  63. 'token' => null,
  64. 'fixtures' => [],
  65. ],
  66. ];
  67. if (! isset($servers[$server])) {
  68. throw new RuntimeException(
  69. 'config.local.php: 未知 server "' . $server . '",可选:' . implode(' / ', array_keys($servers))
  70. );
  71. }
  72. return [
  73. 'default_server' => $server,
  74. 'servers' => $servers,
  75. ];