mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 01:11:38 -05:00
Merge pull request #748 from alphagov/switch-redis-on
Set up REDIS config.
This commit is contained in:
@@ -42,6 +42,7 @@ export LOADTESTING_API_KEY='FIRETEXT_SIMULATION_KEY'
|
||||
export FIRETEXT_API_KEY='FIRETEXT_ACTUAL_KEY'
|
||||
export STATSD_PREFIX='YOU_OWN_PREFIX'
|
||||
export NOTIFICATION_QUEUE_PREFIX='YOUR_OWN_PREFIX'
|
||||
export REDIS_URL="redis://localhost:6379/0"
|
||||
"> environment.sh
|
||||
```
|
||||
|
||||
@@ -55,6 +56,13 @@ NOTES:
|
||||
|
||||
Install [Postgres.app](http://postgresapp.com/). You will need admin on your machine to do this.
|
||||
|
||||
### Redis
|
||||
|
||||
To switch redis on you'll need to install it locally. On a OSX we've used brew for this. To use redis caching you need to switch it on by changing the config for development:
|
||||
|
||||
REDIS_ENABLED = True
|
||||
|
||||
|
||||
## To run the application
|
||||
|
||||
You need to run the api application and a local celery instance.
|
||||
|
||||
@@ -40,6 +40,9 @@ class Config(object):
|
||||
# Prefix to identify queues in SQS
|
||||
NOTIFICATION_QUEUE_PREFIX = os.getenv('NOTIFICATION_QUEUE_PREFIX')
|
||||
|
||||
# URL of redis instance
|
||||
REDIS_URL = os.getenv('REDIS_URL')
|
||||
|
||||
###########################
|
||||
# Default config values ###
|
||||
###########################
|
||||
@@ -133,7 +136,6 @@ class Config(object):
|
||||
STATSD_PORT = 8125
|
||||
|
||||
REDIS_ENABLED = False
|
||||
REDIS_URL = "redis://localhost:6379/0"
|
||||
|
||||
SENDING_NOTIFICATIONS_TIMEOUT_PERIOD = 259200
|
||||
|
||||
@@ -190,6 +192,7 @@ class Preview(Config):
|
||||
CSV_UPLOAD_BUCKET_NAME = 'preview-notifications-csv-upload'
|
||||
API_HOST_NAME = 'http://admin-api.internal'
|
||||
FROM_NUMBER = 'preview'
|
||||
REDIS_ENABLED = True
|
||||
|
||||
|
||||
class Staging(Config):
|
||||
@@ -199,6 +202,7 @@ class Staging(Config):
|
||||
STATSD_ENABLED = True
|
||||
API_HOST_NAME = 'http://admin-api.internal'
|
||||
FROM_NUMBER = 'stage'
|
||||
REDIS_ENABLED = True
|
||||
|
||||
|
||||
class Live(Config):
|
||||
@@ -208,6 +212,7 @@ class Live(Config):
|
||||
STATSD_ENABLED = True
|
||||
API_HOST_NAME = 'http://admin-api.internal'
|
||||
FROM_NUMBER = '40604'
|
||||
REDIS_ENABLED = True
|
||||
|
||||
|
||||
configs = {
|
||||
|
||||
@@ -11,3 +11,4 @@ export LOADTESTING_API_KEY="loadtesting"
|
||||
export FIRETEXT_API_KEY="Firetext"
|
||||
export STATSD_PREFIX="stats-prefix"
|
||||
export NOTIFICATION_QUEUE_PREFIX='testing'
|
||||
export REDIS_URL="redis://localhost:6379/0"
|
||||
|
||||
Reference in New Issue
Block a user