Skip to main content

Validate

Check a config file before osapi starts with it.

The command starts nothing. It exits 1 when the config is not valid, and lists each problem with its rule, the key and the message, then the fix of each rule. Each problem in --json has rule, key (when the problem is about one key), message and fix. osapi config list shows each key, with its type, rule and default.

The rules:

  • file: The config file exists, and osapi can read it. Fix: Give the path with -f, or put the file at /etc/osapi/osapi.yaml. Check that the user that runs osapi can read it.
  • parse: The file is YAML, and each value has the type of its key. Fix: Correct the YAML at the line that the message names. osapi config list shows the type of each key.
  • value: Each value passes the validate rule of its key, with the defaults and the environment applied. Fix: Set the key to a value that its rule allows. osapi config get --key <key> shows its rule, type and default.
  • setting: Each setting of a behavior, under behaviors.<name>, passes its validate rule. Fix: Set the key to a value that its rule allows. osapi behavior get --name <name> lists the settings of the behavior.
  • bucket: Each NATS bucket has its own name. A shared bucket mixes the keys of two roles. Fix: Give one of the two keys that the message names a different bucket.
osapi config validate

Examples​

osapi config validate
osapi config validate -f ./osapi.yaml --json

Global flags​

FlagDescriptionDefault
-d, --debugEnable or disable debug mode
-j, --jsonEnable JSON output
-f, --osapi-filePath to config file/etc/osapi/osapi.yaml

Output tells how the result is printed, and what --json gives.