diff --git a/conf/default.conf.php b/conf/default.conf.php index 485c0a4026..1ff8c86771 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -883,6 +883,10 @@ return array( 'amazon-s3.access-key' => null, 'amazon-s3.secret-key' => null, + // To use a custom endpoint, specify it here. Normally, you do not need to + // configure this. + 'amazon-s3.endpoint' => null, + // Set this to a valid Amazon S3 bucket to store files there. You must also // configure S3 access keys above. 'storage.s3.bucket' => null, diff --git a/src/applications/files/engine/PhabricatorS3FileStorageEngine.php b/src/applications/files/engine/PhabricatorS3FileStorageEngine.php index fa7f9c3dc9..bad2d34a2e 100644 --- a/src/applications/files/engine/PhabricatorS3FileStorageEngine.php +++ b/src/applications/files/engine/PhabricatorS3FileStorageEngine.php @@ -98,13 +98,18 @@ final class PhabricatorS3FileStorageEngine $access_key = PhabricatorEnv::getEnvConfig('amazon-s3.access-key'); $secret_key = PhabricatorEnv::getEnvConfig('amazon-s3.secret-key'); + $endpoint = PhabricatorEnv::getEnvConfig('amazon-s3.endpoint'); if (!$access_key || !$secret_key) { throw new PhabricatorFileStorageConfigurationException( "Specify 'amazon-s3.access-key' and 'amazon-s3.secret-key'!"); } - $s3 = new S3($access_key, $secret_key, $use_ssl = true); + if ($endpoint !== null) { + $s3 = new S3($access_key, $secret_key, $use_ssl = true, $endpoint); + } else { + $s3 = new S3($access_key, $secret_key, $use_ssl = true); + } $s3->setExceptions(true);