Skip to content

Commit f1febb6

Browse files
committed
Merge pull request #77 from jamesmoey/feature/add_iam_support
Feature/add iam support
2 parents bf1a635 + a704707 commit f1febb6

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ uecode_qpush:
7474
- { endpoint: http://example.com/qpush, protocol: http }
7575
```
7676
77+
You may exclude aws key and secret to default to IAM role on the EC2 machine.
78+
7779
##Publishing messages to your Queue
7880
7981
Publishing messages is simple - fetch the registered Provider service from the

docs/aws-provider.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ credentials in your configuration.
4141
subscribers:
4242
- { endpoint: http://example.com/qpush, protocol: http }
4343
44+
You may exclude the aws key and secret if you are using IAM role in EC2.
4445

4546
Using SNS
4647
^^^^^^^^^

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private function getProvidersNode()
5757
$treeBuilder = new TreeBuilder();
5858
$node = $treeBuilder->root('providers');
5959
$requirements = [
60-
'aws' => ['key', 'secret'],
60+
'aws' => [],
6161
'ironmq' => ['token', 'project_id'],
6262
'sync' => [],
6363
'custom' => ['service'],

src/DependencyInjection/UecodeQPushExtension.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,17 @@ private function createAwsClient($config, ContainerBuilder $container, $name)
142142
);
143143
}
144144

145+
$awsConfig = [];
146+
if (!empty($config['key']) && !empty($config['secret'])) {
147+
$awsConfig['key'] = $config['key'];
148+
$awsConfig['secret'] = $config['secret'];
149+
}
150+
151+
$awsConfig['region'] = $config['region'];
152+
145153
$aws = new Definition('Aws\Common\Aws');
146154
$aws->setFactory(['Aws\Common\Aws', 'factory']);
147-
$aws->setArguments([
148-
[
149-
'key' => $config['key'],
150-
'secret' => $config['secret'],
151-
'region' => $config['region']
152-
]
153-
]);
155+
$aws->setArguments([$awsConfig]);
154156

155157
$container->setDefinition($service, $aws)
156158
->setPublic(false);

0 commit comments

Comments
 (0)