This guide is for experienced users who may need to modify the Caldera REST API's configuration JSON file in rare cases, such as debugging or unexpected behavior.
While manual changes are usually unnecessary, this article explains how to safely edit and validate the file when required.
Configuration file location
It is possible to configure the Caldera REST API through a JSON configuration file placed at the following location by default:
/var/lib/caldera-rest-api/.config/Odin/settings.json/opt/caldera-rest-api/etc/settings.jsonIf the APPDATA environment variable is set:
%APPDATA%/Odin/settings.json
If otherwise:
<user-home>/AppData/Roaming/Odin/settings.jsonYou can specify a different file location by setting:
- The
CONFenvironment variable (case insensitive), eg.CONF=./my-conf.json ./Odin - The
--confCLI argument (case insensitive), eg../Odin --conf=./my-conf.json
Warning
The configuration file is used to persist various configurations, including registered services, but if this file is deleted, all registered services will be lost.
Configuration file properties
That file can contain the following properties:
-
serverHost: (string) The address on which the REST API will accept connections, defaulting to"0.0.0.0"(ie. all network interfaces). -
serverPort: (number) The port on which the REST API will listen, defaulting to12340. -
loggerLevel: (string) The log level from which the REST API will output the log, defaulting to"info". The possible log levels are (ordered by criticality ascending):"trace","debug","info","warn","error","fatal". -
loggerPrettify: (boolean) Whether or not to prettify output logs, defaulting tofalse. When not prettified, outputs are JSON-formatted. services: (array | null) List of registered services, defaulting tonullmeaning discovered local services.
Info
Starting with V2, the Caldera REST API no longer searches for local services by default, leaving the service list empty until the user adds one via the API (POST /v1/services).
Each service has the following properties:
Warning
To modify the service list, it is recommended to use the API routes (
POST /v1/services) rather than editing the configuration file directly.-
type: (string) Service type, amongst"calderarip","primecenter", ... -
host: (string) Service address. -
port: (number) Service port. -
license: (string) License ID used to communicate with the service (only relevant for PrimeCenter or DTX products).
-
As for the path to the configuration file, each of those properties can be overridden by:
- Environment variables (case insensitive), eg.
SERVERHOST=127.0.0.1 SERVERPORT=12350 LOGGERLEVEL=trace LOGGERPRETTIFY=true SERVICES=[] ./caldera-rest-api - CLI Arguments (case insensitive), eg.
./Odin --serverHost=127.0.0.1 --serverPort=12350 --loggerLevel=trace --loggerPrettify=true --services=[]
Start Caldera REST API for debugging
You may start the application from a Command Line Interface (CLI) of your Operating System. Here are the locations of the binary files:
/opt/caldera-rest-api/caldera-rest-apiRecommendation
Before executing Caldera REST API on macOS, review your CPU architecture.
/opt/caldera-rest-api/bin/caldera-rest-api-arm64
Or:
/opt/caldera-rest-api/bin/caldera-rest-api-x86_64C:\\Program Files\Caldera REST API\caldera-rest-api.exe