Skip to main content

Environment variables in Mage

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.