SFSQL CLI
Install and Run
- Docker
docker pull registry.xornet.com/sfsql-public/sfsql:latest
docker run -it --rm --name sfsql --add-host=host.docker.internal:host-gateway registry.xornet.com/sfsql-public/sfsql:latest
The SFSQL CLI can read and run SFQL json payloads stored as files.
It can be used to develop, test and benchmark Payloads.
Application startup Parameters override their equivalent ENV Vars.
Parameters:App Parm ENV Var Description -apiurl SF_APIURL The URL of the SFSQL API Endpoint
DEFAULT: http://host.docker.internal:8080/api/v1/run-apikey SF_APIKEY API Access Key
The Key which you set when starting the SFSQL Daemon.
Authenticates this CLI with the daemon.
DEFAULT: none-timeoutsecs SF_HTTPTIMEOUTSECS Timeout waiting for response from SFSQL (default: 10) -sfsqldir SF_SFSQLDIR Default directory to load SFSQL Payload files from. -validatecert SF_APIVALIDATECERT If the API Endpoint is https (secure), validate the cert. 1 = true, 0 = false the below parameters are Docker parameters -v Share a host directory with the CLI
Needed if you wish to run json SFQL Payload files other than those bundled with the CLI.
Use -v multiple times to specify multiple shares.
Example: -v /var/jsonFiles:/var/jsonFiles -v /var/jsonFiles2:/var/jsonFiles2--name The name given to the Docker container.
This name functions as a convenient identifier vs a Docker randomly-generated container name (when this parameter is not defined).
When viewing running Docker containers via the 'docker ps' command, the SFSQL CLI will show up as 'sfsql' when this parameter is set to 'sfsql'--add-host Used to map the domain name 'host.docker.internal' to the ip address of the Docker host -it Run the Docker container and enter the SFSQL CLI prompt --rm Automatically remove the Docker container after exiting the CLI
Use
Commands available from within the CLI are detailed below.
You can display the in-program help at anytime within the CLI by using the 'help' command.
- Commands
Command | Parms | Description |
---|---|---|
help | Display help menu | |
status | Show the CLI status / settings | |
pwd | Show the present working directory | |
cd | [dir] | Change the current sfsqldir to dir |
ls | Lists all the files in the current sfsqldir | |
show | [fName|fIdx] | Displays the contents of the current or specified file (by name or index number). |
load | [fName|fIdx] | Loads the specified file or reloads the last loaded file (by name or index number) into the buffer. Buffer can then be used in future operations without having to specify a file name. |
run | [fName|fIdx|adhoc|xN] | Runs the currently loaded file or last run sfsql, or the specified file (by name or index number), or an adhoc sfsql payload at the sfsql server, or the current buffer N number of times. |
test | [fName|fIdx|adhoc] | Runs the currently loaded file or last run sfsql, or the specified file (by name or index number), or an adhoc sfsql payload at the sfsql server, in test mode, comparing the full result of each command with the value of "_expected_result" and returning 'success=1' if the values match. |
lr | Load-and-Run. Same as load, followed by run. Shortcut for reloading the current file from disk and then running it. | |
lt | Load-and-Test. Same as load, followed by test. Shortcut for reloading the current file from disk and then testing it. | |
version | Display the version of the application | |
exit | Exits the application |