Cli-args are used to overwrite the Application Swoole Server Options, such as document-root, open_http2_protocol, socket type and to reset Access-Control-Allow-Origin
The console commands extends Symfony Console Component.
The console application is created at the very beginning of start_server.php. The command name is start but is set as default command and may not be called.
Options are not ordered (meaning you can specify them in any order) and are specified with two dashes (e.g. --yell). Options are always optional, and can be setup to accept a value (e.g. --dir=src) or as a boolean flag without a value (e.g. --yell).
- document-root - Add default path to project
Example: --document-root=path/to/root
-
disable-static-handler Disables the serving of static files (html, css, images)
Example: --disable-static-handler
-
enable-ssl - Enable ssl: sock_type = SWOOLE_SOCK_TCP | SWOOLE_SSL
Example: --enable-ssl
- enable-http2 - Enable http2: set open_http2_protocol = TRUE
Example: --enable-http2
- cors-origin - Add Cross-Origin Resource Sharing
Example: --cors-origin=192.168.0.52
-
log-level - set the log level for the PSR3- Logger. The possible values are: debug, info, notice, warning, error, critical, alert, emergency. The deault level is debug.
Example: --log-level=warning
To add more options edit Start.php
All options are added in the output property options and then passed to RegistryBackendCli which is the first backend for GuzabaPlatform and will overwrite its CONFIG_DEFAULTS
constant.
The same structure as GuzabaPlatform CONFIG_DEFAULTS must be used.
php app/bin/start_server.php --document-root=public --enable-ssl --enable-http2 --cors-origin=192.168.0.5