summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backend/php-s3/index.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/backend/php-s3/index.php b/backend/php-s3/index.php
index 71877ca..1839320 100644
--- a/backend/php-s3/index.php
+++ b/backend/php-s3/index.php
@@ -1,7 +1,8 @@
<?php
- $access_key = $_ENV['ACCESS_KEY'];
- $secret_key = $_ENV['SECRET_KEY'];
- $bucket = $_ENV['BUCKET'];
+ $access_key = $_ENV['AWS_S3_ID'];
+ $secret_key = $_ENV['AWS_S3_KEY'];
+ $bucket = $_ENV['BUCKET_NAME'];
+ $region = $_ENV['AWS_REGION'];
$path = 'schemas';
if (!$access_key || !$secret_key || !$bucket) {
header("HTTP/1.0 501 Credentials not provided!");
@@ -9,7 +10,7 @@
}
include('amazon-s3-php/src/S3.php');
- $client = new S3($access_key, $secret_key, "s3-us-west-2.amazonaws.com");
+ $client = new S3($access_key, $secret_key, 's3-'.$region.'.amazonaws.com');
$a = (isset($_GET["action"]) ? $_GET["action"] : false);
switch ($a) {
@@ -24,11 +25,11 @@
case "save":
$keyword = (isset($_GET["keyword"]) ? $_GET["keyword"] : "");
$data = file_get_contents("php://input");
- $client->putObject($bucket, $path.'/'.$keyword, $data, array('Content-Type' => 'text/xml'));
- header("HTTP/1.0 201 Created");
+ $client->putObject($bucket, $path.'/'.$keyword, $data, array('Content-Type' => 'text/xml'));
+ header("HTTP/1.0 201 Created");
break;
case "load":
- $keyword = (isset($_GET["keyword"]) ? $_GET["keyword"] : "");
+ $keyword = (isset($_GET["keyword"]) ? $_GET["keyword"] : "");
$file = $client->getObject($bucket, $path.'/'.$keyword);
if ($file->body) {
header("Content-type: text/xml");