-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsettings.ts
More file actions
56 lines (50 loc) · 1.86 KB
/
settings.ts
File metadata and controls
56 lines (50 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { readFileSync } from "fs"
import type { SiteArea } from './types'
import log from "loglevel"
interface PoiPoiSettings
{
persistorUrl: string,
persistorSecret: string,
enableSSL: boolean,
janusServers: { url: string, id: string }[]
janusApiSecret: string
janusRoomNamePrefix: string
janusRoomNameIntPrefix: number
isBehindProxy: boolean
restrictLoginByIp: boolean
abuseIpDBApiKey: string
adminKey: string
censoredWordsRegex: string
noStreamIPs: string[]
siteAreas: SiteArea[]
}
let jsonContents: PoiPoiSettings;
try
{
const fileStringContents = readFileSync("local-settings.json", { encoding: "utf8" })
jsonContents = JSON.parse(fileStringContents)
}
catch {
log.warn("No local-settings.json file found")
jsonContents = JSON.parse(process.env.GIKO2_SETTINGS || "{}" as string)
}
export const settings: PoiPoiSettings = {
enableSSL: jsonContents.enableSSL || false,
persistorUrl: jsonContents.persistorUrl,
persistorSecret: jsonContents.persistorSecret,
janusServers: jsonContents.janusServers || [],
janusApiSecret: jsonContents.janusApiSecret,
janusRoomNamePrefix: jsonContents.janusRoomNamePrefix,
janusRoomNameIntPrefix: jsonContents.janusRoomNameIntPrefix,
isBehindProxy: jsonContents.isBehindProxy == undefined ? true : jsonContents.isBehindProxy,
restrictLoginByIp: jsonContents.restrictLoginByIp == undefined ? true : jsonContents.restrictLoginByIp,
abuseIpDBApiKey: jsonContents.abuseIpDBApiKey,
adminKey: jsonContents.adminKey,
// $-^ is a regex that never matches any string
censoredWordsRegex: jsonContents.censoredWordsRegex || "$-^",
siteAreas: jsonContents.siteAreas || [
{"id": "for", "name": "International", "language": "any"},
{"id": "vip", "name": "VIP", "language": "any"}
],
noStreamIPs: jsonContents.noStreamIPs || []
}