-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathminio-conf.php
40 lines (34 loc) · 1.45 KB
/
minio-conf.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
31
32
33
34
35
36
37
38
39
40
<?php
/*
Plugin Name: Modal Nodes Minio Configurator for S3-Uploads (https://github.com/humanmade/S3-Uploads)
GitHub Plugin URI: https://github.com/modalnodes/mn-minio
Version: 0.1
*/
register_activation_hook( __FILE__, 'child_plugin_activate' );
function child_plugin_activate(){
// Require parent plugin
if ( ! is_plugin_active( 'S3-Uploads/s3-uploads.php' ) and current_user_can( 'activate_plugins' ) ) {
// Stop activation redirect and show error
wp_die('Sorry, but this plugin requires S3-Uploads to be installed and active. <br><a href="' . admin_url( 'plugins.php' ) . '">« Return to Plugins</a>');
}
}
$minio_url = getenv('MINIO_URL'); //http://cdn.example.com/
$minio_key = getenv('MINIO_KEY'); //
$minio_secret = getenv('MINIO_SECRET');
$minio_bucket = getenv('MINIO_BUCKET'); // testbucket
$minio_bucket_url = getenv('MINIO_BUCKET_URL'); //http://cdn.example.com/testbucket
function s3_uploads_s3_client_params_runner( $params ) {
$params['endpoint'] = $minio_url;
$params['credentials'] = [
'key' => $minio_key,
'secret' => $minio_secret,
];
return $params;
}
add_filter( 's3_uploads_s3_client_params', 's3_uploads_s3_client_params_runner', 20, 1 );
define( 'S3_UPLOADS_BUCKET', $minio_bucket );
define( 'S3_UPLOADS_KEY', $minio_key );
define( 'S3_UPLOADS_SECRET', $minio_secret );
define( 'S3_UPLOADS_REGION', 'us-east-1' );
define( 'S3_UPLOADS_BUCKET_URL', $minio_bucket_url);
?>