Skip to main content

Environment variables in Mage Pro

Environment variables are set from the Mage Pro cluster management portal. Check out the steps and video below on how to create environment variables.

Adding or modifying environment variables:

  • Click the “Edit / add variables” button
  • On the Environment Variables screen, you can either input a value directly or add a custom environment variable by specifying its key-value pair
  • Click “Save changes” to update the settings.
After clicking the “Save changes” button the cluster will automatically restart.

Environment variables in Mage OSS

Environment variables may be set in your Docker container to configure Mage settings. If you’re running Mage using pip or conda, your local machine’s environment variables are accessible within the running Mage app. Environment variables are different from runtime variables or secrets. If you’re running Mage using Docker, you must add the following command line flags:
The command to run Mage using Docker could look like this:

Setting the prefix for Mage URL

You may need to add a prefix to the Mage url. You can configure the Mage server to start at a prefix to the url by setting the MAGE_BASE_PATH environment variable. Make sure to set the base path without the leading slash. For example, if you want to start Mage at http://localhost:6789/base/url/path, you would configure your environment variable like this: export MAGE_BASE_PATH=base/url/path You can also configure the base path separately for client requests and backend routes by setting the MAGE_REQUESTS_BASE_PATH and MAGE_ROUTES_BASE_PATH environment variables respectively.

Default variables

These are the environment variables used in Mage.