mini_api.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. return [
  3. // Independent opaque sessions; local test identities are isolated from WeChat.
  4. // This API never uses the admin JWT verifier or trusts user IDs sent by the client.
  5. 'token_verifier' => \app\miniapi\auth\SessionVerifier::class,
  6. 'wechat_appid' => env('MINI_WECHAT_APPID', ''),
  7. 'wechat_secret' => env('MINI_WECHAT_SECRET', ''),
  8. 'environment' => env('APP_ENV', 'production'),
  9. 'test_phone_login' => filter_var(env('MINI_TEST_PHONE_LOGIN', false), FILTER_VALIDATE_BOOLEAN),
  10. 'test_phone_allowed_ips' => array_values(array_filter(array_map('trim', explode(',', (string) env(
  11. 'MINI_TEST_PHONE_ALLOWED_IPS',
  12. '127.0.0.1,::1'
  13. ))))),
  14. // Only these peers may set X-Forwarded-For. Behind a reverse proxy every caller otherwise
  15. // shares one address, which merges login throttling and the test phone allowlist.
  16. // Loopback is trusted by default because it is unreachable from the network; list every
  17. // proxy hop explicitly when deploying behind Nginx or a load balancer.
  18. 'trusted_proxies' => array_values(array_filter(array_map('trim', explode(',', (string) env(
  19. 'MINI_TRUSTED_PROXIES',
  20. '127.0.0.1,::1'
  21. ))))),
  22. 'session_ttl' => 604800,
  23. 'login_ip_per_minute' => 60,
  24. 'login_global_per_minute' => 600,
  25. 'max_photo_body_bytes' => 3000000,
  26. 'support_phone' => env('MINI_SUPPORT_PHONE', ''),
  27. 'purchase_agreement_url' => env('MINI_PURCHASE_AGREEMENT_URL', ''),
  28. 'privacy_url' => env('MINI_PRIVACY_URL', ''),
  29. 'max_body_bytes' => 65536,
  30. 'max_page_size' => 100,
  31. // Exact browser origins only. Local Swagger UI is served by the API on port 8787.
  32. // Override with a comma-separated list for HTTPS deployments; an empty value disables browser origins.
  33. 'allowed_origins' => array_values(array_filter(array_map('trim', explode(',', (string) env(
  34. 'MINI_ALLOWED_ORIGINS',
  35. 'http://127.0.0.1:8787,http://localhost:8787'
  36. ))))),
  37. ];