Automate Environment Variable Management with the CLI or API
Instead of using Runtime Admin to manage environment variables from the UI, automate the environment variable administration with the B2C CLI or the Managed Runtime API.
Also, access environment variables in Node.js by using process.env.
Note
Manage Environment Variables with the B2C CLI
Use the B2C CLI to list all environment variables for an environment, update an environment variable value, and create environment variables from an environment file.
The B2C CLI examples use placeholder values for the project and the environment formatted as <placeholder-value>. Replace placeholders with the actual values for your storefront. To get the project ID, see Find a Project.
When you add a new environment variable, wait for the redeploy of the bundle to complete, and then deploy a new bundle that uses the new variable.
Note
For a complete list of MRT commands, see MRT Commands in the B2C Developer Toolkit.
Manage Environment Variables with the Managed Runtime API
Use the Managed Runtime API to list all environment variables for an environment and update an environment variable value.
Set up the Managed Runtime API
To make API requests, you must include an API key in the HTTP request Authorization header with the value, Bearer $API_KEY. To find your API key, log in to the Runtime Admin tool and go to the Account Settings page.
Treat your API key like a password because it allows scripts to perform operations on your behalf.
Note
This tutorial uses sample curl requests. Before running the commands, replace any placeholders with actual values. Placeholders are formatted as $PLACEHOLDER. Replace $PROJECT_ID with your actual project ID. To get the project ID, see Find a Project.