From d6be17a789e42827ad02e8761fcfe73fc60fed7c Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Sun, 2 May 2021 14:26:47 +1000 Subject: [PATCH] Get devices ip in production, use .env for dev --- .env | 1 + src/App.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 00000000..615be4e2 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +SNOWPACK_PUBLIC_DEVICE_IP= \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index e8012bfc..5f081d13 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -76,9 +76,11 @@ const App = () => { const client = new Client(); const connection = client.createHTTPConnection(); setConnection(connection); - // connection.connect(window.location.hostname, undefined, true); connection.connect({ - address: '192.168.1.103', + address: + import.meta.env.NODE_ENV === 'production' + ? window.location.hostname + : import.meta.env.SNOWPACK_PUBLIC_DEVICE_IP, receiveBatchRequests: false, tls: false, fetchInterval: 2000,