From 9c96185d54a0160a990c043735928d385be9cbf6 Mon Sep 17 00:00:00 2001 From: Boris Kubiak Date: Sat, 23 Dec 2023 11:38:02 +0100 Subject: [PATCH] Get WS_URL from ENV --- src/ha.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ha.ts b/src/ha.ts index aa913f7..35846c0 100644 --- a/src/ha.ts +++ b/src/ha.ts @@ -4,7 +4,8 @@ import { auth } from 'home-assistant-js-websocket/dist/messages.js'; import { debug, warn } from './log.js'; import dayjs from 'dayjs'; -const WS_URL = 'ws://supervisor/core/websocket'; +const WS_URL = process.env.WS_URL || 'ws://supervisor/core/websocket'; +const TOKEN = process.env.SUPERVISOR_TOKEN; export type SuccessMessage = { id: string; @@ -62,7 +63,7 @@ export class HomeAssistantClient { } }); - connection.sendUTF(JSON.stringify(auth(process.env.SUPERVISOR_TOKEN))); + connection.sendUTF(JSON.stringify(auth(TOKEN))); } }); });