I would like to use bedrock / ddev for Wordpress development and Gitlab CI/CD.
I’m struggling with a rather simple task, but maybe I try to fix this the wrong way…
My Server usses Spinup and with a gitlab hook after a push to a branch the whole repository gets pulled to the server (wordpress, plugins and themes) and should contain the latest data. Right now i get the Database connection error, because I don’t know how to separate the ddev local credentials and the production / staging credentials.
I tried to create a .env.production and set the value of WP_ENV to production, but this was not the correct way.
Is this possible with the modified folder structure (web/app and web/wp) or do I have to use the original structure and simply put the wp-config.php with the correct credentials directly on the server?
bedrock/application.php at 6cc89564fa187340276c88105c919d417d485c7d · roots/bedrock · GitHub by default Bedrock is checking for the existence of
.env.local. It sounds like you should be able to use that locally and leave
.env for production as intended.
Thanks for your suggestion, but .env.local does not work, if I delete .env and only use the .env.local file, I get an database connection error after ddev restart.
So i guess, i have to put that into a readme, that everybody who checks out the project has to create the .env file, because locally its always the same setup and gitignore that file.
On the server I put the correct .env file. This way everything works fine, except the server .env is not in version control or secured somewhere else automatically
Is your Bedrock fully up to date and contain the line checking for
.env.local that I linked?