Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set TYPO3_CONTEXT in ddev

Tags:

typo3

ddev

My ddev environment always runs in production mode. How to change that?

SetEnv TYPO3_CONTEXT Development

like image 433
bschauer Avatar asked Jan 24 '26 19:01

bschauer


2 Answers

Just for those who stumble upon this question here. In newer versions of ddev (I have v1.17.5), you have to edit the file .ddev/config.yaml with nano o.e. You can just replace the line

web_environment: []

by

web_environment:
    - TYPO3_CONTEXT=Development

Afterwards you have to restart the environment via ddev restart

You can also use a specific Development Context for Local development.

web_environment:
    - TYPO3_CONTEXT=Development/DDEV

vs

web_environment:
    - TYPO3_CONTEXT=Development/YourHoster

to use another siteconfig for example.

like image 135
Marcel Lange Avatar answered Jan 26 '26 10:01

Marcel Lange


Edit 2023-04-25: There are now many ways to set environment variables that don't require any of this. You can use a .ddev/.env, or add an environment variable to web_environment, etc. See https://ddev.readthedocs.io/en/latest/users/extend/customization-extendibility/#providing-custom-environment-variables-to-a-container

The answer by @marcel is better these days.

Original answer:

There's an easier way that doesn't involve such complexity.

Create a .ddev/docker-compose.typo3.yaml with these contents:

    services:
      web:
        environment:
          - TYPO3_CONTEXT=Development

This does nothing beyond adding that environment variable in the web container. Note that the name of the docker-compose file is not important, it could be docker-compose.envstuff.yaml

like image 24
rfay Avatar answered Jan 26 '26 10:01

rfay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!