Craft CMS 6 ENV vars
Published
Updated
Craft CMS 6 reads Laravel's ENV vars. The software template sets them when the app is created.
ENV vars from the template
Version 6 of the Craft CMS software template sets the Laravel and database ENV vars:
Craft CMS 6
| Deployment | Value |
|---|---|
| Root path | public |
| Deploy strategy | replace |
| Excluded paths | /storage/node_modules |
| Build commands | composer install --no-dev --prefer-dist --no-interaction --no-ansi --no-progress |
| Post-deploy commands | mkdir -p storage/framework/{sessions,views,cache}php artisan migrate --forcephp artisan storage:link --forceif php artisan craft:install:check; then php artisan craft:up; fiif php artisan craft:install:check; then php artisan craft:clear-caches/all; fi |
| Environment variables | Value |
|---|---|
| APP_DEBUG | false |
| APP_ENV | production |
| APP_KEY | !RANDOM_KEY! |
| APP_URL | https://${FORTRABBIT_MAIN_DOMAIN} |
| LOG_CHANNEL | stack |
| LOG_STACK | stderr |
| Database environment variables | Value |
|---|---|
| DB_CONNECTION | mysql |
| DB_DATABASE | ${FORTRABBIT_DB_NAME} |
| DB_HOST | ${FORTRABBIT_DB_HOST} |
| DB_PASSWORD | ${FORTRABBIT_DB_PASSWORD} |
| DB_PORT | ${FORTRABBIT_DB_PORT} |
| DB_USERNAME | ${FORTRABBIT_DB_USER} |
The ${FORTRABBIT_…} values are platform variables that fortrabbit fills in. An app created without the template needs them added by hand:
Differences to Craft 5
DB_CONNECTION=mysqlis needed: the.env.exampleof the Craft 6 skeleton setspgsql.APP_KEYreplacesCRAFT_SECURITY_KEY. The template generates a random one. Data encrypted locally needs the local key on fortrabbit too.APP_URLsets the URLs of the Control Panel. Without it, links point tolocalhost.LOG_STACK=stderrsends the logs to the logs of the environment.
Settings in config/craft/general.php read ENV vars with Laravel's env() helper.