diff --git a/docker/rootfs/start.sh b/docker/rootfs/start.sh index 16d74c5..c42c9ca 100644 --- a/docker/rootfs/start.sh +++ b/docker/rootfs/start.sh @@ -41,6 +41,7 @@ _buildConfig() { echo "define('S3_ACCESS_KEY', '${S3_ACCESS_KEY:-}');" echo "define('S3_SECRET_KEY', '${S3_SECRET_KEY:-}');" echo "define('S3_ENDPOINT', '${S3_ENDPOINT:-}');" + echo "define('S3_REGION', '${S3_REGION:-}');" echo "define('FTP_SERVER', '${FTP_SERVER:-}');" echo "define('FTP_PORT', ${FTP_PORT:-21});" echo "define('FTP_USER', '${FTP_USER:-}');" @@ -84,4 +85,4 @@ touch /var/log/nginx/pictshare/error.log nginx -tail -f /var/log/nginx/pictshare/*.log \ No newline at end of file +tail -f /var/log/nginx/pictshare/*.log diff --git a/rtfm/CONFIG.md b/rtfm/CONFIG.md index ac9d86b..65b40e2 100644 --- a/rtfm/CONFIG.md +++ b/rtfm/CONFIG.md @@ -67,6 +67,7 @@ You can also store all uploaded files on S3 or S3 compatible storage like [Minio |S3_ACCESS_KEY | string | Access key for your bucket| |S3_SECRET_KEY | string | Secret key for your bucket | |S3_ENDPOINT | URL | Server URL. If you're using S3 compatible software like [Minio](https://min.io/) you can enter the URL here | +|S3_REGION | string | Region of your bucket | ### FTP diff --git a/rtfm/DOCKER.md b/rtfm/DOCKER.md index 961a89b..2663e73 100644 --- a/rtfm/DOCKER.md +++ b/rtfm/DOCKER.md @@ -57,6 +57,7 @@ Every other variable can be referenced against the [default PictShare configurat - S3_BUCKET (string | Name of your S3 bucket) - S3_ACCESS_KEY (string | Access Key for your Bucket) - S3_SECRET_KEY (string | Secrety Key) +- S3_REGION (string | S3 bucket region) - S3_ENDPOINT (url | If you are using a selfhosted version of S3 like Minio, put your URL here) - ENCRYPTION_KEY (string | If you want to use encryption for storage controllers, put your encryption key here. [Read more](https://github.com/HaschekSolutions/pictshare/blob/master/rtfm/ENCRYPTION.md)) @@ -67,4 +68,4 @@ Every other variable can be referenced against the [default PictShare configurat - FTP_PASS (string | FTP Password) - FTP_BASEDIR (string | Base path where files will be stored. Must end with / eg `/web/pictshare/`) -- CONTENTCONTROLLERS (CSV string | If set, will whitelist content controllers for your instance. Must be uppercase and can be comma separated. Example: Only Pictures: `IMAGE`, Pictures and Videos: `IMAGE,VIDEO`) \ No newline at end of file +- CONTENTCONTROLLERS (CSV string | If set, will whitelist content controllers for your instance. Must be uppercase and can be comma separated. Example: Only Pictures: `IMAGE`, Pictures and Videos: `IMAGE,VIDEO`) diff --git a/storage-controllers/s3.controller.php b/storage-controllers/s3.controller.php index d1326db..dc727b7 100644 --- a/storage-controllers/s3.controller.php +++ b/storage-controllers/s3.controller.php @@ -16,7 +16,7 @@ class S3Storage implements StorageController require_once(ROOT.DS.'storage-controllers'.DS.'s3'.DS.'aws-autoloader.php'); $this->s3 = new Aws\S3\S3Client([ 'version' => 'latest', - 'region' => 'us-east-1', + 'region' => (is_defined('S3_REGION') && S3_REGION ?S3_REGION:'us-east-1'), 'endpoint' => S3_ENDPOINT, 'use_path_style_endpoint' => true, 'credentials' => [ @@ -105,4 +105,4 @@ class S3Storage implements StorageController 'Key' => $hash ]); } -} \ No newline at end of file +}