Loading doc/configuration.md +35 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,41 @@ An array of "key=value" strings declaring [PHP directives][]. > arguments preceded by the '-d' flag: > `-d upload_max_filesize=20M -d post_max_size=20M` ### S3_MEDIA_ENDPOINT **Type**: string\ **Required**: if using S3 for uploaded media\ **Format**: URL\ **Example**: "https://s3.example.com/bucket/path"\ A URL to an S3 or S3-like API, including any region and bucket names, and any path in the bucket to append. ### S3_MEDIA_KEY **Type**: string\ **Required**: if using S3 for uploaded media\ An access key allowing write access to the S3 endpoint given by [**S3_MEDIA_ENDPOINT**](#s3_media_endpoint). ### S3_MEDIA_SECRET **Type**: string\ **Required**: if using S3 for uploaded media\ The secret paired with the access key given in [**S3_MEDIA_KEY**](#s3_media_key). ### S3_MEDIA_REWRITE_URL **Type**: string\ **Required**: no\ **Format**: URL\ **Example**: "https://my.domain.example.org/"\ A base URL for viewers to access uploaded media. This allows caching proxies, such as CDNs, to be used for accessing files. ### SITE_ADMIN **Type**: string\ Loading plugins/docker-integration.php +3 −3 Original line number Diff line number Diff line Loading @@ -54,13 +54,13 @@ add_filter( // S3-Uploads Integration if ( defined( 'S3_UPLOADS_ENDPOINT_URL' ) || defined( 'WP_CLI' ) ): if ( defined( 'S3_MEDIA_ENDPOINT' ) || defined( 'WP_CLI' ) ): add_filter( 's3_uploads_s3_client_params', function ( $params ) { $params['endpoint'] = S3_UPLOADS_ENDPOINT_URL; $params['endpoint'] = S3_MEDIA_ENDPOINT; $params['bucket_endpoint'] = true; $params['disable_host_prefix_injection'] = true; $params['use_path_style_endpoint'] = true; Loading @@ -80,7 +80,7 @@ add_action( 'plugins_loaded', function() { $fullurl = parse_url( $paths['url'] ); $subdir = $paths['subdir'] ?? ''; if ( defined( 'S3_UPLOADS_ENDPOINT_URL' ) ) { if ( defined( 'S3_MEDIA_ENDPOINT' ) ) { $s3 = S3_Uploads\Plugin::get_instance(); $basedir = str_replace( $paths['basedir'], $s3->get_s3_path(), $paths['basedir'] ); Loading scripts/entrypoint.sh +9 −15 Original line number Diff line number Diff line Loading @@ -112,27 +112,21 @@ setup_database() { setup_s3() { # https://github.com/humanmade/S3-Uploads [[ -v S3_UPLOADS_ENDPOINT_URL ]] && [[ -v S3_ENDPOINT_KEY ]] && [[ -v S3_ENDPOINT_SECRET ]] || [[ -v S3_MEDIA_ENDPOINT ]] && [[ -v S3_MEDIA_KEY ]] && [[ -v S3_MEDIA_SECRET ]] || return 0 if [[ -v S3_UPLOADS_REWRITE_URL ]]; then wp config set S3_UPLOADS_BUCKET_URL "${S3_UPLOADS_REWRITE_URL}" else wp config set S3_UPLOADS_BUCKET_URL "${S3_UPLOADS_ENDPOINT_URL}" fi wp config set S3_UPLOADS_BUCKET_URL "${S3_MEDIA_REWRITE_URL-$S3_MEDIA_ENDPOINT}" wp config set S3_UPLOADS_ENDPOINT_URL "${S3_UPLOADS_ENDPOINT_URL}" wp config set S3_UPLOADS_KEY ${S3_ENDPOINT_KEY} wp config set S3_UPLOADS_SECRET ${S3_ENDPOINT_SECRET} --quiet wp config set S3_MEDIA_ENDPOINT "${S3_MEDIA_ENDPOINT}" wp config set S3_UPLOADS_KEY "${S3_MEDIA_KEY}" wp config set S3_UPLOADS_SECRET "${S3_MEDIA_SECRET}" --quiet # Plugin requires something here, it's not used wp config set S3_UPLOADS_REGION 'eu-west-1' # Due to what appears to be a bug in the plugin, this MUST be a non-empty # string; mostly it just affects the log output wp config set S3_UPLOADS_BUCKET "CONFIGURED-BUCKET" wp config set S3_UPLOADS_BUCKET "media-bucket" # If there is anything in ./media, upload it local contents=( media/* ) Loading @@ -140,7 +134,7 @@ setup_s3() { wp s3-uploads upload-directory media # Clear potentialy sensitive information from environment lest it leaks unset ${!S3_ENDPOINT_*} unset ${!S3_MEDIA_*} } setup_components() { Loading Loading
doc/configuration.md +35 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,41 @@ An array of "key=value" strings declaring [PHP directives][]. > arguments preceded by the '-d' flag: > `-d upload_max_filesize=20M -d post_max_size=20M` ### S3_MEDIA_ENDPOINT **Type**: string\ **Required**: if using S3 for uploaded media\ **Format**: URL\ **Example**: "https://s3.example.com/bucket/path"\ A URL to an S3 or S3-like API, including any region and bucket names, and any path in the bucket to append. ### S3_MEDIA_KEY **Type**: string\ **Required**: if using S3 for uploaded media\ An access key allowing write access to the S3 endpoint given by [**S3_MEDIA_ENDPOINT**](#s3_media_endpoint). ### S3_MEDIA_SECRET **Type**: string\ **Required**: if using S3 for uploaded media\ The secret paired with the access key given in [**S3_MEDIA_KEY**](#s3_media_key). ### S3_MEDIA_REWRITE_URL **Type**: string\ **Required**: no\ **Format**: URL\ **Example**: "https://my.domain.example.org/"\ A base URL for viewers to access uploaded media. This allows caching proxies, such as CDNs, to be used for accessing files. ### SITE_ADMIN **Type**: string\ Loading
plugins/docker-integration.php +3 −3 Original line number Diff line number Diff line Loading @@ -54,13 +54,13 @@ add_filter( // S3-Uploads Integration if ( defined( 'S3_UPLOADS_ENDPOINT_URL' ) || defined( 'WP_CLI' ) ): if ( defined( 'S3_MEDIA_ENDPOINT' ) || defined( 'WP_CLI' ) ): add_filter( 's3_uploads_s3_client_params', function ( $params ) { $params['endpoint'] = S3_UPLOADS_ENDPOINT_URL; $params['endpoint'] = S3_MEDIA_ENDPOINT; $params['bucket_endpoint'] = true; $params['disable_host_prefix_injection'] = true; $params['use_path_style_endpoint'] = true; Loading @@ -80,7 +80,7 @@ add_action( 'plugins_loaded', function() { $fullurl = parse_url( $paths['url'] ); $subdir = $paths['subdir'] ?? ''; if ( defined( 'S3_UPLOADS_ENDPOINT_URL' ) ) { if ( defined( 'S3_MEDIA_ENDPOINT' ) ) { $s3 = S3_Uploads\Plugin::get_instance(); $basedir = str_replace( $paths['basedir'], $s3->get_s3_path(), $paths['basedir'] ); Loading
scripts/entrypoint.sh +9 −15 Original line number Diff line number Diff line Loading @@ -112,27 +112,21 @@ setup_database() { setup_s3() { # https://github.com/humanmade/S3-Uploads [[ -v S3_UPLOADS_ENDPOINT_URL ]] && [[ -v S3_ENDPOINT_KEY ]] && [[ -v S3_ENDPOINT_SECRET ]] || [[ -v S3_MEDIA_ENDPOINT ]] && [[ -v S3_MEDIA_KEY ]] && [[ -v S3_MEDIA_SECRET ]] || return 0 if [[ -v S3_UPLOADS_REWRITE_URL ]]; then wp config set S3_UPLOADS_BUCKET_URL "${S3_UPLOADS_REWRITE_URL}" else wp config set S3_UPLOADS_BUCKET_URL "${S3_UPLOADS_ENDPOINT_URL}" fi wp config set S3_UPLOADS_BUCKET_URL "${S3_MEDIA_REWRITE_URL-$S3_MEDIA_ENDPOINT}" wp config set S3_UPLOADS_ENDPOINT_URL "${S3_UPLOADS_ENDPOINT_URL}" wp config set S3_UPLOADS_KEY ${S3_ENDPOINT_KEY} wp config set S3_UPLOADS_SECRET ${S3_ENDPOINT_SECRET} --quiet wp config set S3_MEDIA_ENDPOINT "${S3_MEDIA_ENDPOINT}" wp config set S3_UPLOADS_KEY "${S3_MEDIA_KEY}" wp config set S3_UPLOADS_SECRET "${S3_MEDIA_SECRET}" --quiet # Plugin requires something here, it's not used wp config set S3_UPLOADS_REGION 'eu-west-1' # Due to what appears to be a bug in the plugin, this MUST be a non-empty # string; mostly it just affects the log output wp config set S3_UPLOADS_BUCKET "CONFIGURED-BUCKET" wp config set S3_UPLOADS_BUCKET "media-bucket" # If there is anything in ./media, upload it local contents=( media/* ) Loading @@ -140,7 +134,7 @@ setup_s3() { wp s3-uploads upload-directory media # Clear potentialy sensitive information from environment lest it leaks unset ${!S3_ENDPOINT_*} unset ${!S3_MEDIA_*} } setup_components() { Loading