process.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. 'webman' => [
  20. 'handler' => Http::class,
  21. 'listen' => 'http://0.0.0.0:8787',
  22. 'count' => cpu_count() * 4,
  23. 'user' => '',
  24. 'group' => '',
  25. 'reusePort' => false,
  26. 'eventLoop' => '',
  27. 'context' => [],
  28. 'constructor' => [
  29. 'requestClass' => Request::class,
  30. 'logger' => Log::channel('default'),
  31. 'appPath' => app_path(),
  32. 'publicPath' => public_path()
  33. ]
  34. ],
  35. // File update detection and automatic reload
  36. 'monitor' => [
  37. 'handler' => app\process\Monitor::class,
  38. 'reloadable' => false,
  39. 'constructor' => [
  40. // Monitor these directories
  41. 'monitorDir' => array_merge([
  42. app_path(),
  43. config_path(),
  44. base_path() . '/process',
  45. base_path() . '/support',
  46. base_path() . '/resource',
  47. base_path() . '/.env',
  48. ], glob(base_path() . '/plugin/*/app'), glob(base_path() . '/plugin/*/config'), glob(base_path() . '/plugin/*/api')),
  49. // Files with these suffixes will be monitored
  50. 'monitorExtensions' => [
  51. 'php', 'html', 'htm', 'env'
  52. ],
  53. 'options' => [
  54. 'enable_file_monitor' => !in_array('-d', $argv) && DIRECTORY_SEPARATOR === '/',
  55. 'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
  56. ]
  57. ]
  58. ]
  59. ];