Add mqtt websocket server settings in env file #299

This commit is contained in:
Kendrick Chan 2020-01-19 21:26:43 +08:00
parent d2286f21ff
commit 3667e122d0
2 changed files with 5 additions and 2 deletions

View file

@ -4,3 +4,5 @@ twig:
strict_variables: '%kernel.debug%'
globals:
gmaps_api_key: "%env(GMAPS_API_KEY)%"
mqtt_host: "%env(MQTT_WS_HOST)%"
mqtt_port: "%env(MQTT_WS_PORT)%"

View file

@ -29,8 +29,8 @@ function initMap() {
// TODO: put this in .env
var mqtt;
var timeout = 2000;
var host = '192.168.56.4';
var port = 8083;
var host = '{{ mqtt_host }}';
var port = {{ mqtt_port }};
function onConnect() {
console.log('connected!');
@ -90,6 +90,7 @@ function mqttConnect() {
mqtt = new Paho.MQTT.Client(host, port, client_id);
var options = {
useSSL: true,
timeout: 3,
onSuccess: onConnect,
};