Logo BrocksiNet


Try to clean the web

Environment variables in Shopware 6 (aka process.env.XYZ)

With environement variabeles you can do a lot in Shopware 6. Especially when you use some build process to deploy your projects or test your plugins. So in this little post I will collect some of the important environment variables I found in Shopware 6. Maybe this will help you to find solutions for common problems. If I miss some variable that might be helpful pls leave a comment so I will update this post.

Content - Environment variables in Shopware 6

Project Root - Process ENV

The PROJECT_ROOT is set by the sh script you executing for example bin/build-administration.sh. Project root is set to the current folder of the project. Project root is also used to generate the ADMIN_ROOT concatenate with /vendor/shopware/administration.


App URL - Process ENV

This is the main URL to the Storefront for example: APP_URL="http://localhost:8080" from file .env located in the root folder of your project.


Mode - Process ENV

To use the hot reloading in Shopware 6 this variable need to be set to development or hot (see code below). If not it will always build the production build for the Adminstration. The mode is set in scripts part from package.json file and depends on which command you are using for example bin/build-administration.sh. If you wanna build with the hot reload function you should use one of this scripts: bin/watch-administration.sh or bin/watch-storefront.sh.

const isDev = process.env.mode === 'development'; // from Administration package.json
const isProd = process.env.mode !== 'development'; // from Administration package.json
const isHotMode = process.env.MODE === 'hot'; // from Storefront package.json

Shopware Admin build only Extensions - Process Env

If you are an plugin developer and often need to rebuild the shopware administration then you can use this environement variable to only build the extensions. This will speed up the build process a lot.


ElasticSearch - Process ENV's

Not every Shopware 6 feature is supported when you using ElasticSearch, also there are some Issues in special cases. So if you wanna disable ElasticSearch you should know that you need to set SHOPWARE_ES_ENABLED to 0 and SHOPWARE_ES_INDEXING_ENABLED to 0. You set this in .env File and maybe restart your docker to get the ENV's updated. Also you should reset the es:index with bin/console es:reset.


Transports: Async/Queued Messages - Process ENV

Since Shopware Version you can use the default Symfony Envoirment Variable to controll async/queued Message target. Uncomment whichever transport you want (or set it in your .env file).

# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=doctrine://default
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages

How to speed up admin build time, use less Memory and do not waste traffic?

If you build the shopware admin you will realize that it is downloading always a chrome browser with ~145mb. This is really wasting time and network traffic. So you should set the PUPPETEER_SKIP_CHROMIUM_DOWNLOAD variable to avoid this. Also when you got problems with Memory during admin build you can set this node option max-old-space-size, in my example below I allow 2000 MB to be used by node/npm during admin build. If you do not need the TYPECHECK for TypeScript you can skip this by setting DISABLE_ADMIN_COMPILATION_TYPECHECK, this also speed up your build time.

export NODE_OPTIONS="--max-old-space-size=2000";

Which file is generating the .env File if there is no one in root folder?

You should look at this file: vendor/shopware/recovery/Install/src/Service/EnvConfigWriter.php it is used during Install Command, Install App and Container Provider. So it is used in every important entry point.

Shopware 6.5: Changed Environment variables

The goal was to unify names to the symfony defaults. So makre sure to adjust your setups.



For sure I am missing some important environement variables 😉 pls tell me in the comments. Thx.

Released - 22.03.2022


About the author

Bild Bjoern
Björn MeyerSoftware Engineer
Björn is interested in the details of web technologies. He started with Joomla, Drupal, Typo3, vBulletin, Fireworks and Photoshop. Today his focus is on PHP for example with Magento 2, Shopware 6 and Symfony. He also likes JavaScript with Angular, React, VueJs and TypeScript. In his free time, he seeks constant balance with swimming, running and yoga.