'How can I set environment variables inside ddev's containers?

I need to set environment variables inside ddev's web container. How can I do that? I've seen techniques that override the nginx configuration and such but that sounds too hard.



Solution 1:[1]

You can use the web_environment in .ddev/config.yaml or ~/.ddev/global_config.yaml. For example,

web_environment:
- SOMEENV=somevalue
- SOMEOTHERENV=someothervalue

More on this topic in the docs.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1