You can use environment variables in Component Service to allow your components to behave or render differently when used in different component sets. Environment variables also allow you to store secrets such as API keys in a secure way.
Environment variables are set in the Squiz Digital Experience Platform (DXP) Console at the component set level. They can be set for the whole component set and overridden for individual components within that set. They cannot be set on the component itself outside of the component set.
You can use environment variables in your Set up your local preview.
You must add environment variable processing to your component’s variables file structure:
You can set environment variables in your local development environment for development and testing purposes:
Implement environment variables with Component Service in Matrix: