wp-discourse
wp-discourse copied to clipboard
Able to set environment variables?

It would be ideal if we could load these as constants. We pull in fresh copies of the database for local/staging but would need to change these pointing to our staging instance of Discourse in the database every time.
Is there any way to set them as ENV vars? I've checked the code base and it seems like we can't, but just wanted to confirm/suggest.
Thanks!
No, there isn't a way to do it now, but I'm open to the idea. If you have any suggestions for how to set it up, please share them.
OK, good to confirm. We use the Auth0 plugin and they allow it to work either way: https://auth0.com/docs/cms/wordpress/configuration#php-constant-setting-storage
E.g. in their example:
// Storing the client secret in a constant.
// Add to wp-config.php or anywhere before WP_Auth0_Options_Generic is instantiated.
// Constant name is "AUTH0_ENV_" + option key in caps.
define( 'AUTH0_ENV_CLIENT_SECRET', 'YOUR_CLIENT_SECRET_HERE' )
This replaces the option called client_secret and doesn't let it be changed in the plugin admin anymore.
We actually don't use the wp-config.php file but have built it into a mu-plugin that looks at the host and then loads the right options. This is a nice way for us to keep these configuration in the codebase and not the database.
Hope this helps a bit :-)