diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index a11fab53..d912927a 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -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)%" diff --git a/templates/home.html.twig b/templates/home.html.twig index 39ea526b..dd7d8897 100644 --- a/templates/home.html.twig +++ b/templates/home.html.twig @@ -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, };