From 16ba2241248bc49caa49adf98a1397f9cfb8cba3 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 14 Aug 2023 14:40:30 -0500 Subject: [PATCH] Get rid of DITTO_RELAY, derive from LOCAL_DOMAIN --- src/config.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/config.ts b/src/config.ts index 461d986b..f13a4079 100644 --- a/src/config.ts +++ b/src/config.ts @@ -35,12 +35,9 @@ const Conf = { ['sign', 'verify'], ); }, - get relay() { - const value = Deno.env.get('DITTO_RELAY'); - if (!value) { - throw new Error('Missing DITTO_RELAY'); - } - return value; + get relay(): `wss://${string}` | `ws://${string}` { + const { protocol, host } = Conf.url; + return `${protocol === 'https:' ? 'wss:' : 'ws:'}//${host}/relay`; }, get localDomain() { return Deno.env.get('LOCAL_DOMAIN') || 'http://localhost:8000';