CLI: Configuration
Learn how to use the CLI to set various configurations to determine how your DryvIQ Platform works.
Table of Contents
The CLI references “skysync.” This is expected.
Overview
Configurations are global settings that control how certain features in the DryvIQ Platform work. You configure variables in the database through the command-line interface or in the appSettings.json file. (The appSettings.json file is in C:\Program Files\SkySync\appSettings.json unless a different directory was specified during installation).
The authentication parameters are provided within the configuration file in all examples. See CLI: Authentication for more information.
Command Format
The format of the request consists of the following three parts:
- skysync-cli: The name of the package
- command(s): The name of the command to run (i.e., connections, jobs, sites, etc.)
- parameters: Any command parameters to be passed in (i.e., json, server, username, password).
The parameters can be passed in on the command line using an equal sign or a space, or they can be passed through a JSON file. In the following examples, the authentication method is the skysync-cli.json method. See CLI: Authentication for more information.
Parameter Values Passed in Using the Equal Sign
In this example, skysync-cli is the package, connections list are the commands, and output-json is the parameter. The parameter output-json is preceded by two dashes and is followed by an equal sign before the parameter value of false.
skysync-cli connections list --output-json=false
Parameter Values Passed in Using the Space
In this example, skysync-cli is the package, connections list are the commands, and output-json is the parameter. The parameter output-json is preceded by two dashes and followed by a space before the parameter value of false.
skysync-cli connections list --output-json false
Parameter With Default --json Parameter
In this example, skysync-cli is the package, connections list are the commands, and json is the parameter. The parameter json is preceded by two dashes and is not followed by a parameter value. The default value in this case is true.
skysync-cli connections list --json
Parameter Values Passed in Using a JSON File
In this example, skysync-cli is the package, connections list are the commands, and the output-json parameter is not part of the command but is specified within the skysync-cli.json file within the same directory as the other skysync-cli files.
skysync-cli connections list
Contents of skysync-cli.json
{
"output-json": true,
}
Package Configuration
The package configuration file can be specified using the config parameter.
Parameter | Description | Required | Default |
---|---|---|---|
config | Path to JSON config file | Optional | skysync-cli.json within the current directory |
Configuration File Location Specified Using a Relative Path
This example demonstrates how to specify the configuration file using a relative path.
skysync-cli connections list --config=config/testConfig.json
Configuration File Location Specified Using an Absolute Path
This example demonstrates how to specify the configuration file using a relative path.
skysync-cli connections list --config=c:/config/testConfig.json
Response Formats
Responses from the server can come in two formats: the default format (which is a table) or JSON (which needs to be specified on the command line or within the configuration file). The command to list the connections will be used to demonstrate the output formats.
Parameter | Description | Required | Default |
---|---|---|---|
output-json, json | Output results as JSON | Optional | false |
Default Format
In this example, the default response format is requested. The following three commands will produce the same result.
Command With Default Output Format
skysync-cli connections list
Command With output-json Parameter
skysync-cli connections list --output-json=false
Command With json Parameter
skysync-cli connections list --json=false
Example Results
ID Name Platform Enabled
5dc531df34554edd96c31272262ad950 My Computer My Computer true
JSON Format
In this example, the JSON format is requested for the response. The following two commands will produce the same result.
Command With Output-json Parameter
skysync-cli connections list --output-json=true
Command With JSON Parameter
skysync-cli connections list --json=true
Command With JSON Parameter
skysync-cli connections list --json
Example Results
[
{
"id": "5dc531df34554edd96c31272262ad950",
"name": "My Computer",
"platform": {
"name": "My Computer",
"id": "fs"
}
}
]
Specify Response Format Within the Configuration File
The response format parameter can be specified within the configuration file along with any authentication parameters. In this example, the response is requested in JSON format.
skysync-cli connections list
Contents of skysync-cli.json
{
"output-json": true,
}
Specify Response Format by Environment Variable
The response format parameter can be specified within an environment variable.
skysync-cli connections list
Environment Variable Name | Value |
---|---|
SKYSYNC_output-json | true, false |
Errors
You may encounter errors while using the CLI. Common errors and likely causes are listed below.
Error Message | Remediation |
---|---|
A valid Bearer token must be provided | Check that the username and password are valid and passed in properly |
getaddrinfo ENOTFOUND | Check that the server and port are correct |
connect ECONNREFUSED | Check that the server and port are correct |