ddev-contrib
ddev-contrib copied to clipboard
Add env_file support on env snippet.
The New Solution/Problem/Issue/Bug:
No env file support provided on the env snippet.
How this PR Solves The Problem:
Provides example snippet with comment. Allows docker-compose to load env files. This is a widely known issue with ddev, i.e. the lack of env file support.
Taken from the offical docs: https://docs.docker.com/compose/environment-variables/#the-env_file-configuration-option
Manual Testing Instructions:
- Add snippet to .ddev folder
- Add .env file to project root, declaring at least one environment variable.
- Boot the ddev project. In the project code do
print_r($_ENV);
- Refresh front-end - given environment variable(s) in the env file should be present in the array.
Related Issue Link(s):
Shouldn't this go into ddev's docs?
As well as here? Probably. Found a solution and wanted to contribute back is all :) . The docs have pointed to this repo for anything on the level of adding custom docker-compose partials.
Yeah, just improve https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#providing-custom-environment-variables-to-a-container - I've been meaning to explore this feature of docker-compose and didn't get it done yet.