Imported site with DB_ param overrides in wp-config-env.php fails to connect to database

Q: Date/Time this occurred (Provide your time zone also)
A: 11:00 AM EST

Q: DevKinsta Version
A: 1.0.1 (1.0.1.1173)

Q: OS Version
A: macOS Catalina 10.15.7

Q: Docker Desktop Version
A: 3.1.0 (51484)

Q: Were any error codes or messages observed? If so, what were they?
A: Both WP Admin and Open site button showed “Fail to connect to database” messages

Q: Detailed Description of the Problem
A: If your imported site has overrides to database params defined in wp-config-env.php, the Wordpress install in DevKinsta will fail to connect to the database because the DevKinsta install only updates credentials in the main wp-config.php file. As a workaround, I commented out the credentials in wp-config-env.php and was able to connect successfully - however, since we’d like to eventually use this tool to push changes to the live/staging Kinsta sites, commenting out that code for local development is not a viable workaround.

Hi @gfitech . Thanks for reporting this issue. To clarify, you have a custom configuration for wp-config.php and instead use wp-config-env.php?

Correct. We do use wp-config.php, but inside of wp-config.php, we check for the existence of “wp-config-env.php” and include_once if it exists - in that file, we put all the config specific to our environment (as opposed to general config, which we do leave in wp-config.php). So even though the wp-config.php is updated to reflect the local environment in DevKinsta, it gets overridden by the config we have in wp-config-env.php and so the local site fails to connect.