process.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. use support\Log;
  3. use support\Request;
  4. use app\process\Http;
  5. global $argv;
  6. return [
  7. 'wash' => [
  8. 'handler' => Http::class,
  9. 'listen' => 'http://0.0.0.0:8890',
  10. 'count' => cpu_count() * 4,
  11. 'user' => '',
  12. 'group' => '',
  13. 'reusePort' => false,
  14. 'eventLoop' => '',
  15. 'context' => [],
  16. 'constructor' => [
  17. 'requestClass' => Request::class,
  18. 'logger' => Log::channel('default'),
  19. 'appPath' => app_path(),
  20. 'publicPath' => public_path()
  21. ]
  22. ],
  23. "wss" => [
  24. "handler" => \app\wss\PrintWss::class,
  25. "listen" => "websocket://0.0.0.0:18890",
  26. "count" => 1
  27. ],
  28. // File update detection and automatic reload
  29. 'monitor' => [
  30. 'handler' => app\process\Monitor::class,
  31. 'reloadable' => false,
  32. 'constructor' => [
  33. // Monitor these directories
  34. 'monitorDir' => array_merge([
  35. app_path(),
  36. config_path(),
  37. base_path() . '/process',
  38. base_path() . '/support',
  39. base_path() . '/resource',
  40. base_path() . '/.env',
  41. ], glob(base_path() . '/plugin/*/app'), glob(base_path() . '/plugin/*/config'), glob(base_path() . '/plugin/*/api')),
  42. // Files with these suffixes will be monitored
  43. 'monitorExtensions' => [
  44. 'php', 'html', 'htm', 'env'
  45. ],
  46. 'options' => [
  47. 'enable_file_monitor' => !in_array('-d', $argv) && DIRECTORY_SEPARATOR === '/',
  48. 'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
  49. ]
  50. ]
  51. ]
  52. ];