-
Notifications
You must be signed in to change notification settings - Fork 393
Use S3 with DigitalOcean
`<?php /**
- Plugin Name: S3 Uploads DigitalOcean Helper
- Plugin URI: https://www.pixeldevs.io
- Description: Helper file to get DigitalOcean Spaces working with S3 Uploads
- Version: 1.0
- Author: PixelDevs
- Author URI: https://www.pixeldevs.io **/
// Filter S3 Uploads params. add_filter( 's3_uploads_s3_client_params', function ( $params ) { if ( defined( 'S3_UPLOADS_ENDPOINT' ) ) { $params['endpoint'] = S3_UPLOADS_ENDPOINT; $params['use_path_style_endpoint'] = true; $params['debug'] = false; // Set to true if uploads are failing. } return $params; }, 5, 1 );`
`define( 'S3_UPLOADS_BUCKET', 'aaaccdn' ); define( 'S3_UPLOADS_REGION', 'sfo3' ); // the s3 bucket region (excluding the rest of the URL)
// You can set key and secret directly: // THESE ARE YOUR SPACES ACCESS KEYS IN DIGITAL OCEAN | API > SPACES ACCESS KEYS define( 'S3_UPLOADS_KEY', 'itsTheSmallerOne' ); define( 'S3_UPLOADS_SECRET', 'ItsTheLargerOne' );
// Or if using IAM instance profiles, you can use the instance's credentials: define( 'S3_UPLOADS_USE_INSTANCE_PROFILE', true );
define('S3_UPLOADS_BUCKET_URL', 'https://aaaccdn.sfo3.digitaloceanspaces.com'); define('S3_UPLOADS_ENDPOINT', 'https://sfo3.digitaloceanspaces.com');`