From 17ea1e7a7b790bc719e2a2d9e108bd2e57db07d4 Mon Sep 17 00:00:00 2001 From: Sander van de Graaf Date: Tue, 9 Jan 2018 13:03:51 +0100 Subject: [PATCH] Allow SQS to use environment variables --- django_q/brokers/aws_sqs.py | 9 ++++++--- docs/configure.rst | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/django_q/brokers/aws_sqs.py b/django_q/brokers/aws_sqs.py index 111e631..d33800f 100644 --- a/django_q/brokers/aws_sqs.py +++ b/django_q/brokers/aws_sqs.py @@ -51,9 +51,12 @@ class Sqs(Broker): @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') diff --git a/docs/configure.rst b/docs/configure.rst index 66136f4..9dddc1e 100644 --- a/docs/configure.rst +++ b/docs/configure.rst @@ -229,7 +229,7 @@ All connection keywords are supported. See the `iron-mq