Utilities
Utility applications to interact with the database are provided. These are deployed to the /opt/spt/bin directory.
Shell
The configsh application provides a shell to interact with the database. The server should be running and the TCP port open for the application to connect.
The following command line options are supported by the shell:
-s | --serverThe TCP server hostname to connect to. Defaultlocalhost.-p | --portThe TCP port to connect to. Default2020(2022on Mac OS X).-t | --with-sslFlag to connect over SSL to the server.-l | --log-levelThe level for the logger. Accepted valuesdebug|info|warn|critical. Defaultinfo.-o | --log-dirThe directory to write log files to. The path must end with a trailing/. Default/tmp/.
The following shows a simple CRUD type interaction via the shell.
CLI
The configctl application provides a simple means for interacting with the database server. Use it to execute single actions against the service when required.
Note: Unlike the shell application, values specified as command line argument must be quoted if they contain spaces or other special characters.
The server should be running and the TCP port open for the application to connect.
The following command line options are supported by the CLI application:
-s | --serverThe TCP server hostname to connect to. Defaultlocalhost.-p | --portThe TCP port to connect to. Default2020(2022on Mac OS X).-t | --with-sslFlag to connect over SSL to the server.-l | --log-levelThe level for the logger. Accepted valuesdebug|info|warn|critical. Defaultinfo.-o | --log-dirThe directory to write log files to. The path must end with a trailing/. Default/tmp/.-f | --fileThe file to bulk import into the database. If specified, other commands are ignored.-a | --actionThe action to perform. One ofget|set|move|delete|list.-k | --keyThe key to act upon.-v | --valueThe value to set. Formovethis is the destination path.
See sample integration test suite.
The following shows a simple CRUD type interaction via the cli. These were using the default values for server [-s|--server] and port [-p|--port] options.
Bulk Import
A special -f | --file option is supported for bulk importing key-value pairs from a file. The input file must contain lines where each line represents a key-value pair. The text before the first space character is interpreted as the key, and the rest of the line as the value.
Note: The entire file is imported as a single transaction. The input file must be small enough to buffer the requests and transaction in memory.
Seed
A seed-configdb utility is provided to seed the database. This can be used to pre-populate the database before the service is started.
Note: This will fail if the service is already running (database locked by running process).
The following command line options are supported by the seed application:
-c | --confOptional JSON configuration file that controls the database storage location.-f | --fileThe data file to import. The input file must contain lines where each line represents a key-value pair. The text before the first space character is interpreted as the key, and the rest of the line as the value.-l | --log-levelThe level for the logger. Accepted valuesdebug|info|warn|critical. Defaultinfo.-o | --log-dirThe directory to write log files to. The path must end with a trailing/. Default/tmp/.