Storing data in Consul's Key/Value store via WordPress
Consul is a distributed KV store, used mainly for service/configuration discovery, service monitoring and general automation facilitation.
WP Consul is a Wordpress plugin that saves arbitrary data from WordPress into Consul's KV store. It updates the data hourly (via WP Cron functionality)
For example:
We allow the plugin to create arbitrary keys under the key we created:
Notice that in this example I have a rule that allows read access to the whole store. This is probably not what you want to do, so I am pointing this out explicitly to have in mind.
Example:
Inside the function wpconsul_updateStore()
, there is a closure that defines the payload for the key. Simply modify it to meet your use case.
/**
* Modify this closure for your use case
*
* @type callable $payload
* @return string
*/
$payload = function () {
return 'Change Me';
};