# Runtime parameters

## Overview

Runtime parameters are key/value pairs that are injected as environment variables into [lifecycle scripts](https://docs.instruqt.com/sandboxes/lifecycle-scripts). The values for runtime parameters can be hard coded values, or sensitive values fetched from our [secrets ](https://docs.instruqt.com/concepts/secrets)feature.

{% hint style="info" %}
Runtime parameters are only injected during lifecycle script executions and are by default not stored in / accessible via containers or virtual machines.
{% endhint %}

{% hint style="warning" %}
Runtime parameters specified when starting a track via the API will override the values configured on an invite if there are duplicate keys.
{% endhint %}

## Configure runtime parameters

Select the sharing method appropriate to your use case.

{% tabs %}
{% tab title="🌐 Embed" %}

1. Copy the [embed URL](https://docs.instruqt.com/tracks/share/embed-a-track) of the track you want to add runtime parameters to.&#x20;
2. Append `rtp_<name>=<value>` or `rts_<name>=<value>` to the URL for runtime parameters and secrets, respectively. In either case, the `<name>` value will be available as an environment variable in lifecycle scripts.&#x20;

The following example sets an environment variable called `USER_ID` to the value `testuser` and an environment variable called `API_KEY` to the value in the configured in the secret named `SECRET_API_KEY`.

```bash
https://play.instruqt.com/embed/TEAM/tracks/EXAMPLE?token=TOKEN&rtp_USER_ID=testuser&rts_API_KEY=SECRET_API_KEY
```

{% endtab %}

{% tab title="✉️ Invites" %}

1. Select the invite you want to add runtime parameters to. Learn how to create invites [here](https://docs.instruqt.com/tracks/share/track-invite-links).&#x20;
2. Below the **Add content** section, beside *Advanced options*, click **+Runtime parameters.**&#x20;
3. Click the **Add secret** or **Add variable** buttons to add a secret or variable parameters.&#x20;
   * For **Secrets** you will input a key (any name you like) and select a value (an existing secret)
   * For Variables you will input a key and a value.
4. Repeat as needed, adding as many parameters as needed.
5. Click **Save changes** in the bottom-left corner.&#x20;
   {% endtab %}

{% tab title="🧪 Track test" %}
To specify runtime parameters in track tests, use the `--runtime-parameters` flag where the value is a comma delimited list of key/value pairs separated by an `=` sign.&#x20;

To specify runtime secrets use the `--runtime-secrets` flag where the value is a comma delimited list of key/value pairs separated by an `=` sign and the value part is the name of a secret.

The following example sets an environment variable called `USER_ID` to the value `testuser` and an environment variable called `API_KEY` to the value in the configured in the secret named `SECRET_API_KEY`.

```
instruqt track test TEAM/TRACK --runtime-parameters=USER_ID=testuser --runtime-secrets=API
```

{% endtab %}

{% tab title="🔥 Hot start" %}
&#x20;If you are making use of [hot start](https://docs.instruqt.com/concepts/hot-start) tracks, runtime parameters will not be available in the sandbox setup script. \
\
Tracks that need to be hot started and make use of runtime parameters should do setup in the first challenges setup script.
{% endtab %}
{% endtabs %}
