WordPress wp-config.php env variables issue

[ad_1]

Hello!
I am kinda confused on how to approach this.
Currently I have created a wp-config.php file in a docker container.

[Image above shows the information in the file.])

I also have a script that runs the following:

​

I am using the latest WP image and it has apache2 on it.
What should I write in the wp-config in order to pass the env variables from the script.
\*YES I KNOW\* that the script adds ” as env’s in this above example , but It needs to be dynamic as I can change it anytime.

[ad_2]
2 Comments
  1. Assuming that USER_DB, PASS_DB etc are the credentials for the database that you want to use for WordPress, you should either:

    change your script so that USER_DB becomes WORDPRESS_DB_USER (and the other variables are changed to match what’s expected by wp_config.php

    OR

    edit wp-config.php so that the line becomes: define(‘DB_NAME’, getenv(‘USER_DB’, ‘mysql’));

    …and so on for the other variables

  2. You could set `WORDPRESS_CONFIG_EXTRA` as described in the container’s [readme]) for additional config variables. There is actually no need to change a WP container’s wp-config.php.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer