Merged in develop (pull request #7)

Add env variable for MQTT_CLIENT_ID
master
Ensar Sarajcic 2018-10-08 20:49:28 +00:00
commit d2ed28e70b
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 REDIS_URL=redis://localhost:6379
CELERY_TASK_SERIALIZER=json CELERY_TASK_SERIALIZER=json
DEBUG=True 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 = Flask(__name__, instance_relative_config=True)
app.config.from_object('config') app.config.from_object('config')
app.config.from_pyfile('config.py', silent=True) 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 = make_celery(app)
task_builder.autodiscover_tasks(['app.devices']) 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" SECRET_KEY = "?['Z(Z\x83Y \x06T\x12\x96<\xff\x12\xe0\x1b\xd1J\xe0\xd9ld"
# MQTT configuration # 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_URL = 'broker.hivemq.com'
MQTT_BROKER_PORT = 1883 MQTT_BROKER_PORT = 1883
MQTT_USERNAME = 'user' MQTT_USERNAME = 'user'