# Run time variables

::: info This feature has been introduced in vREST NG CLI v2.4.0. :::

In this guide, we will look at, how you may pass run time variables through vREST NG CLI command. Run time variables are helpful in passing sensitive data like credentials to the vREST NG CLI command. Rest of the variables can be configured through environment variables via option --env.

There are two options to configure the run-time variables. Both options can be used simultaneously to configure the run-time variables.

  1. using --envfilepath option Using this option you may provide a JSON file path containing run time variables. The file contains a JSON object contains key/value pairs as shown below:
{
  "username": "admin",
  "password": "secret",
  "numberVar": 10,
  "booleanVar": true,
  "falseVar": false,
  "objectVar": {
    "hello": "world"
  },
  "arrayVar": [
    "hello",
    "world"
  ]
}
  1. using --vars option Using --vars option, you may configure the run-time variables directly through the command line. e.g.
vrest-ng-cli run --projectdir=/path/to/your/project/directory 
            --vars.username=admin
            --vars.password=secret
            --vars.numberVar=10
            --vars.booleanVar
            --no-vars.falseVar
            --vars.objectVar.hello=world
            --vars.arrayVar=hello
            --vars.arrayVar=world

Note:

  1. For sending the boolean true value, just specify the variable name only e.g. --vars.booleanVar
  2. For sending the boolean false value, just prefix the variable with no- e.g. `--no-vars.falseVar
  3. For sending the object value, use the dot notation to send deeply nested values e.g. --vars.objectVar.hello=world
  4. For sending the array value, repeat the variable multiple times.

Caveats:

  1. As of now, you cannot send number string using --vars option.
  2. As of now, you cannot send array with single element using --vars option.