» Command: apply

The sentinel apply command is used to execute a policy locally for development purposes.

» Usage

Usage: sentinel apply [options] POLICY

This command executes the policy file at the path specified by POLICY.

Use the exit code of this command to determine the exact status of the policy evaluation. 0 is pass, 1 is fail, 2 is undefined (fail, but because the result was undefined), and 3 is a runtime error. Errors unrelated to the policy status itself are returned with an exit status of 9.

To control the behavior of the apply command, create a configuration file. With this, you can define available import plugins, mock data, and global values. This can help you simulate a policy embedded within an application.

The command-line flags are all optional. The list of available flags are:

  • -config=path - Path to a configuration file specifying available imports, mock data, globals, etc. The default is sentinel.json.

  • -global key=value - Global values to inject into the running policy. This is equivalent to setting "global" in the configuration file. Any keys set here will override conflicting keys in the configuration. The value should be a JSON value. If the first character is not a valid JSON starting symbol, then the entire value is treated as a string.

  • -trace - Always show the execution trace. This shows intermediate boolean expression values. This always shows for failed policies.