Issues (1019)

config/laravels.php (2 issues)

1
<?php
2
3
return [
4
    /*
5
    |--------------------------------------------------------------------------
6
    | LaravelS Settings
7
    |--------------------------------------------------------------------------
8
    |
9
    | English https://github.com/hhxsv5/laravel-s/blob/master/Settings.md#laravels-settings
10
    | Chinese https://github.com/hhxsv5/laravel-s/blob/master/Settings-CN.md#laravels-%E9%85%8D%E7%BD%AE%E9%A1%B9
11
    |
12
    */
13
14
    /*
15
    |--------------------------------------------------------------------------
16
    | The IP address of the server
17
    |--------------------------------------------------------------------------
18
    |
19
    | IPv4: use "127.0.0.1" to listen local address, and "0.0.0.0" to listen all addresses.
20
    | IPv6: use "::1" to listen local address, and "::"(equivalent to 0:0:0:0:0:0:0:0) to listen all addresses.
21
    |
22
    */
23
24
    'listen_ip' => env('LARAVELS_LISTEN_IP', '127.0.0.1'),
25
26
    /*
27
    |--------------------------------------------------------------------------
28
    | The port of the server
29
    |--------------------------------------------------------------------------
30
    |
31
    | Require root privilege if port is less than 1024.
32
    |
33
    */
34
35
    'listen_port' => env('LARAVELS_LISTEN_PORT', 5200),
36
37
    /*
38
    |--------------------------------------------------------------------------
39
    | The socket type of the server
40
    |--------------------------------------------------------------------------
41
    |
42
    | Usually, you don’t need to care about it.
43
    | Unless you want Nginx to proxy to the UnixSocket Stream file, you need
44
    | to modify it to SWOOLE_SOCK_UNIX_STREAM, and listen_ip is the path of UnixSocket Stream file.
45
    | List of socket types:
46
    | SWOOLE_SOCK_TCP: TCP
47
    | SWOOLE_SOCK_TCP6: TCP IPv6
48
    | SWOOLE_SOCK_UDP: UDP
49
    | SWOOLE_SOCK_UDP6: UDP IPv6
50
    | SWOOLE_UNIX_DGRAM: Unix socket dgram
51
    | SWOOLE_UNIX_STREAM: Unix socket stream
52
    | Enable SSL: $sock_type | SWOOLE_SSL. To enable SSL, check the configuration about SSL.
53
    | https://www.swoole.co.uk/docs/modules/swoole-server-doc
54
    | https://www.swoole.co.uk/docs/modules/swoole-server/configuration
55
    |
56
    */
57
58
    'socket_type' => defined('SWOOLE_SOCK_TCP') ? SWOOLE_SOCK_TCP : 1,
59
60
    /*
61
    |--------------------------------------------------------------------------
62
    | Server Name
63
    |--------------------------------------------------------------------------
64
    |
65
    | This value represents the name of the server that will be
66
    | displayed in the header of each request.
67
    |
68
    */
69
70
    'server' => env('LARAVELS_SERVER', ''),
71
72
    /*
73
    |--------------------------------------------------------------------------
74
    | Handle Static Resource
75
    |--------------------------------------------------------------------------
76
    |
77
    | Whether handle the static resource by LaravelS(Require Swoole >= 1.7.21, Handle by Swoole if Swoole >= 1.9.17).
78
    | Suggest that Nginx handles the statics and LaravelS handles the dynamics.
79
    | The default path of static resource is base_path('public'), you can modify swoole.document_root to change it.
80
    |
81
    */
82
83
    'handle_static' => env('LARAVELS_HANDLE_STATIC', false),
84
85
    /*
86
    |--------------------------------------------------------------------------
87
    | Laravel Base Path
88
    |--------------------------------------------------------------------------
89
    |
90
    | The basic path of Laravel, default base_path(), be used for symbolic link.
91
    |
92
    */
93
94
    'laravel_base_path' => env('LARAVEL_BASE_PATH', base_path()),
0 ignored issues
show
The function base_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

94
    'laravel_base_path' => env('LARAVEL_BASE_PATH', /** @scrutinizer ignore-call */ base_path()),
Loading history...
95
96
    /*
97
    |--------------------------------------------------------------------------
98
    | Inotify Reload
99
    |--------------------------------------------------------------------------
100
    |
101
    | This feature requires inotify extension.
102
    | https://github.com/hhxsv5/laravel-s#automatically-reload-after-modifying-code
103
    |
104
    */
105
106
    'inotify_reload' => [
107
        // Whether enable the Inotify Reload to reload all worker processes when your code is modified.
108
        'enable'        => env('LARAVELS_INOTIFY_RELOAD', false),
109
110
        // The file path that Inotify watches
111
        'watch_path'    => base_path(),
112
113
        // The file types that Inotify watches
114
        'file_types'    => ['.php'],
115
116
        // The excluded/ignored directories that Inotify watches
117
        'excluded_dirs' => [],
118
119
        // Whether output the reload log
120
        'log'           => true,
121
    ],
122
123
    /*
124
    |--------------------------------------------------------------------------
125
    | Swoole Event Handlers
126
    |--------------------------------------------------------------------------
127
    |
128
    | Configure the event callback function of Swoole, key-value format,
129
    | key is the event name, and value is the class that implements the event
130
    | processing interface.
131
    |
132
    | https://github.com/hhxsv5/laravel-s#configuring-the-event-callback-function-of-swoole
133
    |
134
    */
135
136
    'event_handlers' => [],
137
138
    /*
139
    |--------------------------------------------------------------------------
140
    | WebSockets
141
    |--------------------------------------------------------------------------
142
    |
143
    | Swoole WebSocket Server settings.
144
    |
145
    | https://github.com/hhxsv5/laravel-s#enable-websocket-server
146
    |
147
    */
148
149
    'websocket' => [
150
        'enable' => false,
151
        // 'handler' => XxxWebSocketHandler::class,
152
    ],
153
154
    /*
155
    |--------------------------------------------------------------------------
156
    | Sockets - multi-port mixed protocol
157
    |--------------------------------------------------------------------------
158
    |
159
    | The socket(port) list for TCP/UDP.
160
    |
161
    | https://github.com/hhxsv5/laravel-s#multi-port-mixed-protocol
162
    |
163
    */
164
165
    'sockets' => [],
166
167
    /*
168
    |--------------------------------------------------------------------------
169
    | Custom Process
170
    |--------------------------------------------------------------------------
171
    |
172
    | Support developers to create custom processes for monitoring,
173
    | reporting, or other special tasks.
174
    |
175
    | https://github.com/hhxsv5/laravel-s#custom-process
176
    |
177
    */
178
179
    'processes' => [],
180
181
    /*
182
    |--------------------------------------------------------------------------
183
    | Timer
184
    |--------------------------------------------------------------------------
185
    |
186
    | Wrapper cron job base on Swoole's Millisecond Timer, replace Linux Crontab.
187
    |
188
    | https://github.com/hhxsv5/laravel-s#millisecond-cron-job
189
    |
190
    */
191
192
    'timer' => [
193
        'enable'          => env('LARAVELS_TIMER', false),
194
195
        // The list of cron job
196
        'jobs'            => [
197
            // Enable LaravelScheduleJob to run `php artisan schedule:run` every 1 minute, replace Linux Crontab
198
            // Hhxsv5\LaravelS\Illuminate\LaravelScheduleJob::class,
199
        ],
200
201
        // Max waiting time of reloading
202
        'max_wait_time'   => 5,
203
204
        // Enable the global lock to ensure that only one instance starts the timer
205
        // when deploying multiple instances.
206
        // This feature depends on Redis https://laravel.com/docs/8.x/redis
207
        'global_lock'     => false,
208
        'global_lock_key' => config('app.name', 'Laravel'),
0 ignored issues
show
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

208
        'global_lock_key' => /** @scrutinizer ignore-call */ config('app.name', 'Laravel'),
Loading history...
209
    ],
210
211
    /*
212
    |--------------------------------------------------------------------------
213
    | Swoole Tables
214
    |--------------------------------------------------------------------------
215
    |
216
    | All defined tables will be created before Swoole starting.
217
    |
218
    | https://github.com/hhxsv5/laravel-s#use-swooletable
219
    |
220
    */
221
222
    'swoole_tables' => [],
223
224
    /*
225
    |--------------------------------------------------------------------------
226
    | Re-register Providers
227
    |--------------------------------------------------------------------------
228
    |
229
    | The Service Provider list, will be re-registered each request, and run method boot()
230
    | if it exists. Usually, be used to clear the Service Provider
231
    | which registers Singleton instances.
232
    |
233
    | https://github.com/hhxsv5/laravel-s/blob/master/Settings.md#register_providers
234
    |
235
    */
236
237
    'register_providers' => [],
238
239
    /*
240
    |--------------------------------------------------------------------------
241
    | Cleaners
242
    |--------------------------------------------------------------------------
243
    |
244
    | The list of cleaners for each request is used to clean up some residual
245
    | global variables, singleton objects, and static properties to avoid
246
    | data pollution between requests.
247
    |
248
    | https://github.com/hhxsv5/laravel-s/blob/master/Settings.md#cleaners
249
    |
250
    */
251
252
    'cleaners' => [],
253
254
    /*
255
    |--------------------------------------------------------------------------
256
    | Destroy Controllers
257
    |--------------------------------------------------------------------------
258
    |
259
    | Automatically destroy the controllers after each request to solve
260
    | the problem of the singleton controllers.
261
    |
262
    | https://github.com/hhxsv5/laravel-s/blob/master/KnownIssues.md#singleton-controller
263
    |
264
    */
265
266
    'destroy_controllers' => [
267
        'enable'        => false,
268
        'excluded_list' => [],
269
    ],
270
271
    /*
272
    |--------------------------------------------------------------------------
273
    | Swoole Settings
274
    |--------------------------------------------------------------------------
275
    |
276
    | Swoole's original configuration items.
277
    |
278
    | More settings
279
    | Chinese https://wiki.swoole.com/#/server/setting
280
    | English https://www.swoole.co.uk/docs/modules/swoole-server/configuration
281
    |
282
    */
283
284
    'swoole' => [
285
        'daemonize'          => env('LARAVELS_DAEMONIZE', false),
286
        'dispatch_mode'      => env('LARAVELS_DISPATCH_MODE', 3),
287
        'worker_num'         => env('LARAVELS_WORKER_NUM', 30),
288
        //'task_worker_num'    => env('LARAVELS_TASK_WORKER_NUM', 10),
289
        'task_ipc_mode'      => 1,
290
        'task_max_request'   => env('LARAVELS_TASK_MAX_REQUEST', 100000),
291
        'task_tmpdir'        => @is_writable('/dev/shm/') ? '/dev/shm' : '/tmp',
292
        'max_request'        => env('LARAVELS_MAX_REQUEST', 100000),
293
        'open_tcp_nodelay'   => true,
294
        'pid_file'           => storage_path('laravels.pid'),
295
        'log_level'          => env('LARAVELS_LOG_LEVEL', 4),
296
        'log_file'           => storage_path(sprintf('logs/swoole-%s.log', date('Y-m'))),
297
        'document_root'      => base_path('public'),
298
        'buffer_output_size' => 2 * 1024 * 1024,
299
        'socket_buffer_size' => 8 * 1024 * 1024,
300
        'package_max_length' => 4 * 1024 * 1024,
301
        'reload_async'       => true,
302
        'max_wait_time'      => 60,
303
        'enable_reuse_port'  => true,
304
        'enable_coroutine'   => false,
305
        'upload_tmp_dir'     => @is_writable('/dev/shm/') ? '/dev/shm' : '/tmp',
306
        'http_compression'   => env('LARAVELS_HTTP_COMPRESSION', false),
307
    ],
308
];
309