process.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * This file is part of webman.
  4. *
  5. * Licensed under The MIT License
  6. * For full copyright and license information, please see the MIT-LICENSE.txt
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @author walkor<walkor@workerman.net>
  10. * @copyright walkor<walkor@workerman.net>
  11. * @link http://www.workerman.net/
  12. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  13. */
  14. use support\Log;
  15. use support\Request;
  16. use app\process\Http;
  17. global $argv;
  18. return [
  19. 'mqtt' => [
  20. 'handler' => app\process\MqttSubscriber::class,
  21. 'count' => 1,
  22. 'reloadable' => false,
  23. ],
  24. 'webman' => [
  25. 'handler' => Http::class,
  26. 'listen' => 'http://0.0.0.0:8787',
  27. 'count' => cpu_count() * 4,
  28. 'user' => '',
  29. 'group' => '',
  30. 'reusePort' => false,
  31. 'eventLoop' => '',
  32. 'context' => [],
  33. 'constructor' => [
  34. 'requestClass' => Request::class,
  35. 'logger' => Log::channel('default'),
  36. 'appPath' => app_path(),
  37. 'publicPath' => public_path()
  38. ]
  39. ],
  40. // File update detection and automatic reload
  41. 'monitor' => [
  42. 'handler' => app\process\Monitor::class,
  43. 'reloadable' => false,
  44. 'constructor' => [
  45. // Monitor these directories
  46. 'monitorDir' => array_merge([
  47. app_path(),
  48. config_path(),
  49. base_path() . '/process',
  50. base_path() . '/support',
  51. base_path() . '/resource',
  52. base_path() . '/.env',
  53. ], glob(base_path() . '/plugin/*/app'), glob(base_path() . '/plugin/*/config'), glob(base_path() . '/plugin/*/api')),
  54. // Files with these suffixes will be monitored
  55. 'monitorExtensions' => [
  56. 'php', 'html', 'htm', 'env'
  57. ],
  58. 'options' => [
  59. 'enable_file_monitor' => !in_array('-d', $argv) && DIRECTORY_SEPARATOR === '/',
  60. 'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
  61. ]
  62. ]
  63. ]
  64. ];