Links

Using secrets in a track

Give tracks access to Secrets.
To make use of a Secret value in a tracks lifecycle scripts the track must to be granted access to the secret.
This provides better visibility to which secrets a track makes use of and adds a layer of security by limiting which secrets a track has access to.

Before you begin

You must have already built a track to which you access to a Secret.

Allowing a track access to Secrets

🌐 Web UI
💻 Instruqt CLI
  1. 1.
    Open your browser and go to play.instruqt.com. ↳ Instruqt shows your content.
  2. 2.
    Click the TRACK_NAME of the track to which you want to give secret access. ↳ Instruqt shows the corresponding Track dashboard page.
  3. 3.
    In the Sandbox section, click Edit to open the Sandbox page.
  4. 4.
    Click + Add a secret. ↳ The Add secrets pop-up opens.
  5. 5.
    Select the secrets you would like access in your track scripts by clicking the checked box.
  6. 6.
    Click Save. ↳ Instruqt shows the Sandbox page with your newly configured secrets.
Add the following code into config.yml, where SECRET_NAME is the name of the secret you would like to make use of in the tracks lifecycle scripts.
secrets:
- name: SECRET_NAME
↳ Your config.yml file should be similar to this:
version: "3"
secrets:
- name: MY_SECRET_KEY
- name: ANOTHER_SECRET_KEY

Using environment variables

Adding a Secret to your track sets an environment variable which is available for the duration of a tracks lifecycle scripts.

Example

Making an authorised curl request using a username and password.
1. Add a Secret with SITE_PASSWORD as the name and the password as the value.
2. Add the following to your lifecycle script:
curl --user name:${SITE_PASSWORD} http://www.example.com