-
Notifications
You must be signed in to change notification settings - Fork 6
/
plugin.php
30 lines (26 loc) · 1.19 KB
/
plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
* Plugin Name: HashiCorp Vault integration for WordPress
* Description: Access Vault secrets, utilising WordPress APIs for maximum scalability.
* Author: Human Made Limited
* Author URI: https://humanmade.com
* License: MIT
* Version: 1.0.0
*
* @package HM\Hashicorp_Vault
*
* This integration uses `csharpru/vault-php`, which connects to a HashiCorp Vault service with
* a HTTP API using token-based authentication, and returns the requested secret. We cache that
* response using the transients API to avoid large amounts of external HTTP requests.
*
* Almost everything in Vault has an associated lease, and when the lease is expired, the secret
* is revoked. To renew the lease, we fetch the entire secret again to get a new lease. This
* process is automated with the wp-cron API, and is triggered when a new secret is fetched.
*
* To avoid potential race conditions with a cold cache, we use `wpdesk/wp-mutex` which is a
* concurrency locking library for WordPress. wp-mutex uses MySQL application-level locks.
*/
declare( strict_types = 1 );
namespace HM\Hashicorp_Vault;
require_once __DIR__ . '/inc/functions.php';
add_action( 'muplugins_loaded', __NAMESPACE__ . '\set_up' );