Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow SQS to use environment variables #283

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions django_q/brokers/aws_sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ def info(self):

@staticmethod
def get_connection(list_key=Conf.PREFIX):
return Session(aws_access_key_id=Conf.SQS['aws_access_key_id'],
aws_secret_access_key=Conf.SQS['aws_secret_access_key'],
region_name=Conf.SQS['aws_region'])
config = Conf.SQS
if 'aws_region' in config:
config['region_name'] = config['aws_region']
del(config['aws_region'])
return Session(**config)


def get_queue(self):
self.sqs = self.connection.resource('sqs')
Expand Down
8 changes: 4 additions & 4 deletions docs/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ All connection keywords are supported. See the `iron-mq <https://github.com/iron

sqs
~~~
To use Amazon SQS as a broker you need to provide the AWS region and credentials::
To use Amazon SQS as a broker you need to provide the AWS region and credentials either via the config, or any other boto3 configuration method::

# example SQS broker connection

Expand All @@ -241,9 +241,9 @@ To use Amazon SQS as a broker you need to provide the AWS region and credentials
'queue_limit': 100,
'bulk': 5,
'sqs': {
'aws_region': 'us-east-1',
'aws_access_key_id': 'ac-Idr.....YwflZBaaxI',
'aws_secret_access_key': '500f7b....b0f302e9'
'aws_region': 'us-east-1', # optional
'aws_access_key_id': 'ac-Idr.....YwflZBaaxI', # optional
'aws_secret_access_key': '500f7b....b0f302e9' # optional
}
}

Expand Down