rhubarbgroup / redis-cache

A persistent object cache backend for WordPress powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
https://wordpress.org/plugins/redis-cache/
GNU General Public License v3.0
439 stars 150 forks source link

Support for ENV variables as configuration #400

Closed jordy758 closed 1 year ago

jordy758 commented 1 year ago

Hi guys,

It would be nice if we could set configuration settings through environment variables (retrieved through getenv()). This way we can support dockerized containers that use environment variables which discards the need to change anything in the wp_config.php itself.

tillkruss commented 1 year ago

You can already do that, you just have to set the constants in your config from environment variables.

define('WP_REDIS_HOST', getenv('REDIS_HOST'));

define('WP_REDIS_PORT', getenv('REDIS_PORT'));

And so on.