typo3ddev

How to set TYPO3_CONTEXT in ddev


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

SetEnv TYPO3_CONTEXT Development


Solution

  • 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