Skip to content

Commit c377b60

Browse files
committed
wip
1 parent 93272e4 commit c377b60

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

hasura/functions/match/get_match_tv_connection_string.sql

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ CREATE OR REPLACE FUNCTION public.get_match_tv_connection_string(match public.ma
99
tv_port int;
1010
started_at timestamp;
1111
tv_delay int;
12+
match_id uuid;
1213
use_playcast text;
14+
relay_domain text;
1315
BEGIN
14-
SELECT s.host, s.tv_port, m.started_at, mo.tv_delay
15-
INTO server_host, tv_port, started_at, tv_delay
16+
SELECT s.host, s.tv_port, m.started_at, mo.tv_delay, m.id
17+
INTO server_host, tv_port, started_at, tv_delay, match_id
1618
FROM matches m
1719
INNER JOIN servers s ON s.id = m.server_id
1820
INNER JOIN match_options mo on mo.id = m.match_options_id
@@ -29,10 +31,11 @@ CREATE OR REPLACE FUNCTION public.get_match_tv_connection_string(match public.ma
2931
return null;
3032
end if;
3133

34+
relay_domain := get_setting('relay_domain');
3235
use_playcast := get_setting('use_playcast', 'false');
3336

34-
if(use_playcast = 'true') then
35-
return CONCAT('playcast ', '"https://relay.5stack.gg/', match_id, '"');
37+
if(use_playcast = 'true' and relay_url is not null) then
38+
return CONCAT('playcast ', '"', relay_domain, match_id, '"');
3639
else
3740
return CONCAT('connect ', CONCAT(server_host, ':', tv_port), '; password ', password);
3841
end if;

src/configs/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default (): {
1010
wsDomain: `wss://${process.env.WS_DOMAIN}`,
1111
webDomain: `https://${process.env.WEB_DOMAIN}`,
1212
apiDomain: `https://${process.env.API_DOMAIN}`,
13+
relayDomain: `https://${process.env.RELAY_DOMAIN}`,
1314
demosDomain: `https://${process.env.DEMOS_DOMAIN}`,
1415
authCookieDomain:
1516
process.env.AUTH_COOKIE_DOMAIN || `.${process.env.WEB_DOMAIN}`,

src/configs/types/AppConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export type AppConfig = {
55
wsDomain: string;
66
webDomain: string;
77
apiDomain: string;
8+
relayDomain: string;
89
demosDomain: string;
910
authCookieDomain: string;
1011
};

src/hasura/hasura.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ export class HasuraService {
127127
"insert into settings (name, value) values ('demos_domain', $1) on conflict (name) do update set value = $1",
128128
[this.appConfig.demosDomain],
129129
);
130+
131+
await this.postgresService.query(
132+
"insert into settings (name, value) values ('relay_domain', $1) on conflict (name) do update set value = $1",
133+
[this.appConfig.relayDomain],
134+
);
130135
}
131136

132137
private async applyMigrations(path: string): Promise<number> {

0 commit comments

Comments
 (0)