Merge pull request #140 from FN-Florian/master

Add S3_REDGION varaible
This commit is contained in:
Christian Haschek
2022-06-27 08:19:06 +02:00
committed by GitHub
4 changed files with 7 additions and 4 deletions

View File

@@ -41,6 +41,7 @@ _buildConfig() {
echo "define('S3_ACCESS_KEY', '${S3_ACCESS_KEY:-}');" echo "define('S3_ACCESS_KEY', '${S3_ACCESS_KEY:-}');"
echo "define('S3_SECRET_KEY', '${S3_SECRET_KEY:-}');" echo "define('S3_SECRET_KEY', '${S3_SECRET_KEY:-}');"
echo "define('S3_ENDPOINT', '${S3_ENDPOINT:-}');" echo "define('S3_ENDPOINT', '${S3_ENDPOINT:-}');"
echo "define('S3_REGION', '${S3_REGION:-}');"
echo "define('FTP_SERVER', '${FTP_SERVER:-}');" echo "define('FTP_SERVER', '${FTP_SERVER:-}');"
echo "define('FTP_PORT', ${FTP_PORT:-21});" echo "define('FTP_PORT', ${FTP_PORT:-21});"
echo "define('FTP_USER', '${FTP_USER:-}');" echo "define('FTP_USER', '${FTP_USER:-}');"
@@ -84,4 +85,4 @@ touch /var/log/nginx/pictshare/error.log
nginx nginx
tail -f /var/log/nginx/pictshare/*.log tail -f /var/log/nginx/pictshare/*.log

View File

@@ -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_ACCESS_KEY | string | Access key for your bucket|
|S3_SECRET_KEY | string | Secret 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_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 ### FTP

View File

@@ -57,6 +57,7 @@ Every other variable can be referenced against the [default PictShare configurat
- S3_BUCKET (string | Name of your S3 bucket) - S3_BUCKET (string | Name of your S3 bucket)
- S3_ACCESS_KEY (string | Access Key for your Bucket) - S3_ACCESS_KEY (string | Access Key for your Bucket)
- S3_SECRET_KEY (string | Secrety Key) - 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) - 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)) - 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_PASS (string | FTP Password)
- FTP_BASEDIR (string | Base path where files will be stored. Must end with / eg `/web/pictshare/`) - 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`) - 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`)

View File

@@ -16,7 +16,7 @@ class S3Storage implements StorageController
require_once(ROOT.DS.'storage-controllers'.DS.'s3'.DS.'aws-autoloader.php'); require_once(ROOT.DS.'storage-controllers'.DS.'s3'.DS.'aws-autoloader.php');
$this->s3 = new Aws\S3\S3Client([ $this->s3 = new Aws\S3\S3Client([
'version' => 'latest', 'version' => 'latest',
'region' => 'us-east-1', 'region' => (is_defined('S3_REGION') && S3_REGION ?S3_REGION:'us-east-1'),
'endpoint' => S3_ENDPOINT, 'endpoint' => S3_ENDPOINT,
'use_path_style_endpoint' => true, 'use_path_style_endpoint' => true,
'credentials' => [ 'credentials' => [
@@ -105,4 +105,4 @@ class S3Storage implements StorageController
'Key' => $hash 'Key' => $hash
]); ]);
} }
} }