Set environment variables locally

You can set environment variables to test them in your local preview.

Before you start


To set an environment variable locally:

  1. In your CLI, close the local server if it is running.

  2. Run the following command:

    export BRAND_PRIMARY_COLOR=red

  3. Run the following command to test it:


    You will see the word 'red' appear on your CLI.

    This image shows the CLI with the commands entered as above

    The environment variable is now available in the runtime environment for your component.

  4. Start your local development server:

    dxp-next cmp dev components