Yao command

yao <command> [options] [args...]
CommandDescription
initProject initialization
versionDisplays the current version number
inspectDisplay application configuration information
migrateUpdate data table structure
runrun process
startStart WEB service
socketEstablish Socket connection
websocketEstablish a WebSocket connection
dumpExport application data
restoreImport application data

Global options:

parametershorthanddescription
--app-aSpecify application path
--env-eSpecify environment variable file
--help-hCommand help

yao version

Show Yao version number

yao version

yao init

Project initialization, creating files and directories such as app.json, data, models, etc.

cd /path/app
yao init

yao inspect

Display application configuration information

cd /path/app
yao inspect

yao migrate

Update the database structure and create the data tables defined under the application engine and models folder. By default, the data table associated with the data model under models is updated.

Note: The `migrate --reset` command will clear the current data table, not recommended in `production` mode is used.

Options:

parametershorthanddescription
--name-nSpecify model name
--resetRebuild after forced deletion of data table
--forceIn production mode, force the use of migrate
cd /path/app
yao migrate
cd /path/app
yao migrate -n pet

yao run

To run the process, the first parameter is the process name, and the rest of the parameters are the process parameter table.

If you need to enter complex data structures, you can use the :: prefix to declare the parameters in JSON format, for example: '::{"foo":"bar"}'

cd /path/app
yao run scripts.day.NextDay 2020-01-02
cd /path/app
yao run xiang.flow.Return hello '::{"foo":"bar"}'

yao start

start web service

Options:

parametershorthanddescription
--alphaEnable closed beta feature
--debugStart in development mode
cd /path/app
yao start
cd /path/app
yao start --debug

yao socket

Establish a socket connection. Establishing a Socket Connection Using the Socket Widget DSL

cd /path/app
yao socket gate.g02

yao websocket

Establish a WebSocket connection. Establishing a WebSocket Connection Using the Socket Widget DSL

cd /path/app
yao websocket message

yao dump

Export app data

cd /path/app
yao dump

yao restore

Import application data, the parameter is the application data package file exported using the yao dump command.

cd /path/app
yao restore /backup/path/edge-20220827151641.zip

Environment variables

variabledescriptiondefault valueexample
YAO_LANGCommand Line Language en-US English zh-CN Simplified Chineseen-USzh-CN
YAO_ENVRunning mode development development environment
production production environment
productionproduction
YAO_ROOTApplication DirectoryCurrent Directory ./data/app
YAO_HOSTWEB service HOST0.0.0.0127.0.0.1
YAO_PORTWEB service port50995099
YAO_LOGApplication log file locationSystem stdout/data/app/logs/application.log
YAO_LOG_MODELog format TEXT | JSONTEXTJSON
YAO_JWT_SECRETJWT secretEmpty by defaultbLp@bi!oqo-2U+hoTRUG
YAO_DB_DRIVERdatabase driver mysql | sqlite3sqlite3mysql
YAO_DB_PRIMARYMain database connection./db/yao.dbroot:123456@tcp(db-server:3306)/yao?charset=utf8mb4&parseTime=True&loc=Local
YAO_DB_PRIMARYSlave connectionEmptyroot:123456@tcp(db-server:3306)/yao?charset=utf8mb4&parseTime=True&loc=Local
YAO_DB_AESKEYEncrypted Field Key (MySQL Only)EmptyZLX=T&f6refeCh-ro*r@
YAO_SESSION_STORESession data storage mode memory | redismemoryredis
YAO_SESSION_HOSTRedis server HOST (session storage is valid for redis)127.0.0.1127.0.0.1
YAO_SESSION_PORTRedis server port (session storage mode is valid for redis)63796379
YAO_SESSION_PASSWORDRedis password (redis valid for session storage)empty123456

Tips: Environment variables can be set individually for applications. Add .env to the application root directory, and the environment variables declared in .env will be used preferentially when the service is started.

Yao command

yao <command> [options] [args...]
CommandDescription
initProject initialization
versionDisplays the current version number
inspectDisplay application configuration information
migrateUpdate data table structure
runrun process
startStart WEB service
socketEstablish Socket connection
websocketEstablish a WebSocket connection
dumpExport application data
restoreImport application data

Global options:

parametershorthanddescription
--app-aSpecify application path
--env-eSpecify environment variable file
--help-hCommand help

yao version

Show Yao version number

yao version

yao init

Project initialization, creating files and directories such as app.json, data, models, etc.

cd /path/app
yao init

yao inspect

Display application configuration information

cd /path/app
yao inspect

yao migrate

Update the database structure and create the data tables defined under the application engine and models folder. By default, the data table associated with the data model under models is updated.

Note: The `migrate --reset` command will clear the current data table, not recommended in `production` mode is used.

Options:

parametershorthanddescription
--name-nSpecify model name
--resetRebuild after forced deletion of data table
--forceIn production mode, force the use of migrate
cd /path/app
yao migrate
cd /path/app
yao migrate -n pet

yao run

To run the process, the first parameter is the process name, and the rest of the parameters are the process parameter table.

If you need to enter complex data structures, you can use the :: prefix to declare the parameters in JSON format, for example: '::{"foo":"bar"}'

cd /path/app
yao run scripts.day.NextDay 2020-01-02
cd /path/app
yao run xiang.flow.Return hello '::{"foo":"bar"}'

yao start

start web service

Options:

parametershorthanddescription
--alphaEnable closed beta feature
--debugStart in development mode
cd /path/app
yao start
cd /path/app
yao start --debug

yao socket

Establish a socket connection. Establishing a Socket Connection Using the Socket Widget DSL

cd /path/app
yao socket gate.g02

yao websocket

Establish a WebSocket connection. Establishing a WebSocket Connection Using the Socket Widget DSL

cd /path/app
yao websocket message

yao dump

Export app data

cd /path/app
yao dump

yao restore

Import application data, the parameter is the application data package file exported using the yao dump command.

cd /path/app
yao restore /backup/path/edge-20220827151641.zip

Environment variables

variabledescriptiondefault valueexample
YAO_LANGCommand Line Language en-US English zh-CN Simplified Chineseen-USzh-CN
YAO_ENVRunning mode development development environment
production production environment
productionproduction
YAO_ROOTApplication DirectoryCurrent Directory ./data/app
YAO_HOSTWEB service HOST0.0.0.0127.0.0.1
YAO_PORTWEB service port50995099
YAO_LOGApplication log file locationSystem stdout/data/app/logs/application.log
YAO_LOG_MODELog format TEXT | JSONTEXTJSON
YAO_JWT_SECRETJWT secretEmpty by defaultbLp@bi!oqo-2U+hoTRUG
YAO_DB_DRIVERdatabase driver mysql | sqlite3sqlite3mysql
YAO_DB_PRIMARYMain database connection./db/yao.dbroot:123456@tcp(db-server:3306)/yao?charset=utf8mb4&parseTime=True&loc=Local
YAO_DB_PRIMARYSlave connectionEmptyroot:123456@tcp(db-server:3306)/yao?charset=utf8mb4&parseTime=True&loc=Local
YAO_DB_AESKEYEncrypted Field Key (MySQL Only)EmptyZLX=T&f6refeCh-ro*r@
YAO_SESSION_STORESession data storage mode memory | redismemoryredis
YAO_SESSION_HOSTRedis server HOST (session storage is valid for redis)127.0.0.1127.0.0.1
YAO_SESSION_PORTRedis server port (session storage mode is valid for redis)63796379
YAO_SESSION_PASSWORDRedis password (redis valid for session storage)empty123456

Tips: Environment variables can be set individually for applications. Add .env to the application root directory, and the environment variables declared in .env will be used preferentially when the service is started.