GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — server/config.ts at main · sprksocial/server

Expand file tree

/

config.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
200 lines (179 loc) · 5.01 KB
/

config.ts

Copy path

File metadata and controls

200 lines (179 loc) · 5.01 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
import * as dotenv from "dotenv";
import { envInt, envList, envStr } from "@atp/common/server";
dotenv.config({ quiet: true });
export interface ServerConfigValues {
version?: string;
debugMode?: boolean;
port?: number;
publicUrl?: string;
serverDid: string;
privateKey: string;
alternateAudienceDids: string[];
modServiceDid: string;
adminPasswords: string[];
indexedAtEpoch?: Date;
bigThreadUris: Set<string>;
bigThreadDepth?: number;
maxThreadDepth?: number;
maxThreadParents: number;
notificationsDelayMs: number;
videoCdn?: string;
mediaCdn?: string;
dbUri?: string;
dbName?: string;
dbUser?: string;
dbPass?: string;
relayUrl?: string;
plcUrl?: string;
labelsFromIssuerDids: string[];
// Push notifications (FCM handles both iOS and Android)
pushEnabled: boolean;
fcmServiceAccount?: string;
}
export class ServerConfig {
constructor(private cfg: ServerConfigValues) {}
static readEnv() {
const version = envStr("SPRK_VERSION");
const debugMode = Deno.env.get("NODE_ENV") === "development" ||
Deno.env.get("NODE_ENV") === "test";
const port = envInt("SPRK_PORT") ?? 3000;
const publicUrl = envStr("SPRK_PUBLIC_URL") ?? undefined;
const serverDid = envStr("SPRK_SERVER_DID") ?? "did:example:test";
const privateKey = envStr("SPRK_PRIVATE_KEY") ?? "";
const alternateAudienceDids = envList("SPRK_ALTERNATE_AUDIENCE_DIDS") ?? [];
const modServiceDid = envStr("SPRK_MOD_SERVICE_DID") ?? "did:web:localhost";
const adminPasswords = envList("SPRK_ADMIN_PASSWORDS") ?? ["admin-token"];
const indexedAtEpochEnv = Deno.env.get("SPRK_INDEXED_AT_EPOCH");
const indexedAtEpoch = indexedAtEpochEnv !== undefined
? new Date(indexedAtEpochEnv)
: undefined;
const bigThreadUris = new Set(envList("SPRK_BIG_THREAD_URIS"));
const bigThreadDepth = envInt("SPRK_BIG_THREAD_DEPTH") ?? 10;
const maxThreadDepth = envInt("SPRK_MAX_THREAD_DEPTH") ?? 10;
const maxThreadParents = envInt("SPRK_MAX_THREAD_PARENTS") ?? 10;
const notificationsDelayMs = envInt("SPRK_NOTIFICATIONS_DELAY_MS") ?? 10;
const videoCdn = envStr("SPRK_VIDEO_CDN") ?? "https://video.sprk.so";
const mediaCdn = envStr("SPRK_MEDIA_CDN") ?? "https://media.sprk.so";
const dbUri = envStr("SPRK_DB_URI") ??
"mongodb://mongo:mongo@localhost:27017/dev";
const dbName = envStr("SPRK_DB_NAME") ?? "dev";
const dbUser = envStr("SPRK_DB_USER") ?? "mongo";
const dbPass = envStr("SPRK_DB_PASS") ?? "mongo";
const relayUrl = envStr("SPRK_RELAY") ??
"wss://relay1.us-east.bsky.network";
const plcUrl = envStr("SPRK_PLC") ?? "https://plc.directory";
const labelsFromIssuerDids = envList("SPRK_LABELS_FROM_ISSUER_DIDS") ?? [];
// Push notifications (FCM handles both iOS and Android)
const pushEnabled = Deno.env.get("SPRK_PUSH_ENABLED") === "true";
const fcmServiceAccount = envStr("SPRK_FCM_SERVICE_ACCOUNT");
return new ServerConfig({
version,
debugMode,
port,
publicUrl,
serverDid,
privateKey,
alternateAudienceDids,
modServiceDid,
adminPasswords,
indexedAtEpoch,
bigThreadUris,
bigThreadDepth,
maxThreadDepth,
maxThreadParents,
notificationsDelayMs,
videoCdn,
mediaCdn,
dbUri,
dbName,
dbUser,
dbPass,
relayUrl,
plcUrl,
labelsFromIssuerDids,
pushEnabled,
fcmServiceAccount,
});
}
get version() {
return this.cfg.version;
}
get debugMode() {
return this.cfg.debugMode;
}
get port() {
return this.cfg.port;
}
get publicUrl() {
return this.cfg.publicUrl;
}
get serverDid() {
return this.cfg.serverDid;
}
get privateKey() {
return this.cfg.privateKey;
}
get alternateAudienceDids() {
return this.cfg.alternateAudienceDids;
}
get modServiceDid() {
return this.cfg.modServiceDid;
}
get adminPasswords() {
return this.cfg.adminPasswords;
}
get indexedAtEpoch() {
return this.cfg.indexedAtEpoch;
}
// Threads
get bigThreadDepth() {
return this.cfg.bigThreadDepth;
}
get bigThreadUris() {
return this.cfg.bigThreadUris;
}
get maxThreadParents() {
return this.cfg.maxThreadParents;
}
get maxThreadDepth() {
return this.cfg.maxThreadDepth;
}
get notificationsDelayMs() {
return this.cfg.notificationsDelayMs;
}
// CDNs
get videoCdn() {
return this.cfg.videoCdn;
}
get mediaCdn() {
return this.cfg.mediaCdn;
}
get dbUri() {
return this.cfg.dbUri;
}
get dbName() {
return this.cfg.dbName;
}
get dbUser() {
return this.cfg.dbUser;
}
get dbPass() {
return this.cfg.dbPass;
}
get relayUrl() {
return this.cfg.relayUrl;
}
get plcUrl() {
return this.cfg.plcUrl;
}
get labelsFromIssuerDids() {
return this.cfg.labelsFromIssuerDids;
}
// Push notifications (FCM handles both iOS and Android)
get pushEnabled() {
return this.cfg.pushEnabled;
}
get fcmServiceAccount() {
return this.cfg.fcmServiceAccount;
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.