diff --git a/VApp/index.html b/VApp/index.html index 3a098737..b30958fd 100644 --- a/VApp/index.html +++ b/VApp/index.html @@ -1,6 +1,7 @@ Brain Blast +
diff --git a/VApp/public/config.js b/VApp/public/config.js new file mode 100644 index 00000000..af1e2481 --- /dev/null +++ b/VApp/public/config.js @@ -0,0 +1,7 @@ +window.APP_CONFIG = { + mqttBrokerUrl: 'ws://192.168.73.252:9001', + redBuzzerIP: '192.168.73.40', + blueBuzzerIP: '192.168.73.41', + orangeBuzzerIP: '192.168.73.42', + greenBuzzerIP: '192.168.73.43' +}; diff --git a/VApp/src/config.js b/VApp/src/config.js index 9d7c57f0..3eea9c6c 100644 --- a/VApp/src/config.js +++ b/VApp/src/config.js @@ -1,16 +1,15 @@ -// Fichier vide, regarde config.js.example pour personaliser ce fichier. -// Note de dev : Normalement ce fichier ne devrait plus avoir de -// modifications - // config.js -export default { - mqttBrokerUrl: 'ws://192.168.73.252:9001', +// Reads configuration from window.APP_CONFIG (loaded via public/config.js) +// This allows runtime configuration changes without rebuilding the app. - // Buzzer +const defaults = { + mqttBrokerUrl: 'ws://192.168.73.252:9001', redBuzzerIP: '192.168.73.40', blueBuzzerIP: '192.168.73.41', orangeBuzzerIP: '192.168.73.42', greenBuzzerIP: '192.168.73.43' - - // Light }; + +const config = window.APP_CONFIG || defaults; + +export default config; diff --git a/VContainers/VApp/config/config.js b/VContainers/VApp/config/config.js new file mode 100644 index 00000000..e90c2370 --- /dev/null +++ b/VContainers/VApp/config/config.js @@ -0,0 +1,12 @@ +window.APP_CONFIG = { + // URL du broker MQTT (WebSockets) + // En dev local avec le setup VContainers, utiliser 'ws://localhost:9001' + // En prod, utiliser l'IP du serveur, ex: 'ws://192.168.73.252:9001' + mqttBrokerUrl: 'ws://localhost:9001', + + // IPs des buzzers + redBuzzerIP: '192.168.73.40', + blueBuzzerIP: '192.168.73.41', + orangeBuzzerIP: '192.168.73.42', + greenBuzzerIP: '192.168.73.43' +}; diff --git a/VContainers/run.sh b/VContainers/run.sh index e121832e..621c03e1 100755 --- a/VContainers/run.sh +++ b/VContainers/run.sh @@ -17,7 +17,7 @@ echo "Starting NanoMQ..." # NanoMQ needs to expose ports for external access (e.g. VApp frontend) and be on the network for VNode podman run -dt --rm --network $NETWORK_NAME --name nanomq \ -p 1883:1883 -p 9001:9001 -p 8081:8081 -p 8083:8083 -p 8883:8883 \ - -v ./VContainers/MQTT/config/nanomq.conf:/etc/nanomq.conf \ + -v ./VContainers/MQTT/config/nanomq.conf:/etc/nanomq.conf:Z \ docker.io/emqx/nanomq:latest --conf /etc/nanomq.conf echo "Starting VNode..." @@ -26,6 +26,8 @@ podman run -dt --rm --network $NETWORK_NAME --name vnode vnode:latest echo "Starting VApp..." # VApp (nginx) needs port 80 exposed -podman run -dt --rm --network $NETWORK_NAME --name vapp -p 8080:80 vapp:latest +podman run -dt --rm --network $NETWORK_NAME --name vapp -p 8080:80 \ + -v ./VContainers/VApp/config/config.js:/usr/share/nginx/html/config.js:Z \ + vapp:latest echo "All containers started on network $NETWORK_NAME."