Commit 2d417968 authored by Fränk Klein's avatar Fränk Klein
Browse files

Adapt `verify` command for Instance Profiles.

When using AWS Instance Profiles, no credentials (Key ID, Secret Key)
need to be set.
parent d2e64850
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -416,10 +416,13 @@ class S3_Uploads_WP_CLI_Command extends WP_CLI_Command {
	private function verify_s3_access_constants() {
		$required_constants = [
			'S3_UPLOADS_BUCKET',
			'S3_UPLOADS_KEY',
			'S3_UPLOADS_SECRET',
		];

		// Credentials do not need to be set when using AWS Instance Profiles.
		if ( ! defined( 'S3_UPLOADS_USE_INSTANCE_PROFILE' ) || ! S3_UPLOADS_USE_INSTANCE_PROFILE ) {
			array_push( $required_constants, 'S3_UPLOADS_KEY', 'S3_UPLOADS_SECRET' );
		}

		$all_set = true;
		foreach ( $required_constants as $constant ) {
			if ( ! defined( $constant ) ) {