Skip to content

Commit

Permalink
Merge pull request #11 from ShoppinPal/kestrel_options_s3_endpoint
Browse files Browse the repository at this point in the history
Add support for additional config options in kestrel, and endpoint support in S3
  • Loading branch information
szeber authored Jul 17, 2017
2 parents 8f9a890 + 5156dea commit 744b36f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/FileStorage/S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ public function __construct($configName)
],
];

$endpoint = $config->get('commonResource.s3.' . $configName . '.endpoint');
if ($endpoint) {
$clientConfig['endpoint'] = $endpoint;
}

if ($config->get('commonResource.s3.' . $configName . '.usePathStyleEndpoint')) {
$clientConfig['use_path_style_endpoint'] = true;
}

$this->bucketName = $config->get('commonResource.s3.' . $configName . '.bucketName');

if ($region) {
Expand Down
15 changes: 12 additions & 3 deletions src/Queue/KestrelQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,17 @@ class KestrelQueue implements IQueue

public function __construct($configName)
{
$storageName = Config::getInstance()->get('commonResource.kestrel.' . $configName . '.storageName');
$this->storage = StorageFactory::get($storageName);
$config = Config::getInstance();
$storageName = $config->get('commonResource.kestrel.' . $configName . '.storageName');
$this->storage = StorageFactory::get($storageName);
$this->reliableReads = $config->get(
'commonResource.kestrel.' . $configName . '.reliableReads',
true
);
$this->autoClosePreviousReliableRead = $config->get(
'commonResource.kestrel.' . $configName . '.autoClosePreviousReliableRead',
false
);
}

public function sendMessage($queueConfigName, $messageBody)
Expand All @@ -41,7 +50,7 @@ public function receiveMessage($queueConfigName, $waitTimeSeconds = 0)

$result = $this->storage->get(implode('/', $getParts));

return empty($result) ? null : new QueueMessage(json_decode($result));
return empty($result) ? null : new QueueMessage(json_decode($result, true));
}

public function deleteMessage($queueConfigName, $deleteId)
Expand Down

0 comments on commit 744b36f

Please sign in to comment.