Add env variable for MQTT_CLIENT_ID

develop
esensar 2018-10-08 22:48:57 +02:00
parent ad2fc52ba1
commit 057e9e2b19
3 changed files with 3 additions and 2 deletions

1
.env
View File

@ -2,3 +2,4 @@ DATABASE_URL="postgresql://localhost"
REDIS_URL=redis://localhost:6379
CELERY_TASK_SERIALIZER=json
DEBUG=True
MQTT_CLIENT=local

View File

@ -5,6 +5,6 @@ from .tasks.celery_configurator import make_celery
app = Flask(__name__, instance_relative_config=True)
app.config.from_object('config')
app.config.from_pyfile('config.py', silent=True)
app.config['MQTT_CLIENT_ID'] = 'final-iot-backend-server-worker'
app.config['MQTT_CLIENT_ID'] = app.config['MQTT_CLIENT_ID'] + '-worker'
task_builder = make_celery(app)
task_builder.autodiscover_tasks(['app.devices'])

View File

@ -29,7 +29,7 @@ CSRF_SESSION_KEY = "secret"
SECRET_KEY = "?['Z(Z\x83Y \x06T\x12\x96<\xff\x12\xe0\x1b\xd1J\xe0\xd9ld"
# MQTT configuration
MQTT_CLIENT_ID = 'final-iot-backend-server-local2'
MQTT_CLIENT_ID = 'final-iot-backend-server-' + os.environ['MQTT_CLIENT']
MQTT_BROKER_URL = 'broker.hivemq.com'
MQTT_BROKER_PORT = 1883
MQTT_USERNAME = 'user'