Skip to content

Commit f8fc8ac

Browse files
committed
feat: use custom f2f:// protocol for F2F_APP env var
Distinguishes app credentials from RTCV_SERVER basic auth. f2f://keyId:keySecret@host maps to http://host for requests. No protocol enforcement — just documented convention.
1 parent 15fb8cd commit f8fc8ac

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lib/server.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export interface ServerOptions {
2222

2323
// Optional:
2424
alternativeServer?: string | false // If not set will try to use RTCV_ALTERNATIVE_SERVER env variable, if set to false will disable alternative server
25-
f2fApp?: string | false // If not set will try to use F2F_APP env variable (format: https://keyId:keySecret@host), if set to false will disable app mode
26-
f2fAlternativeApp?: string | false // If not set will try to use F2F_ALTERNATIVE_APP env variable, if set to false will disable alternative app
25+
f2fApp?: string | false // If not set will try to use F2F_APP env variable (format: f2f://keyId:keySecret@host), if set to false will disable app mode
26+
f2fAlternativeApp?: string | false // If not set will try to use F2F_ALTERNATIVE_APP env variable (same format), if set to false will disable alternative app
2727
port?: number // If not set will try to use SERVER_PORT or default to: 3000
2828
noHealthChecks?: boolean // If set to true will disable health checks on the RT-CV server
2929
skipSlugCheck?: boolean // If set to true will not check and update the slug on the RT-CV server
@@ -143,19 +143,19 @@ export class Server {
143143
options.skipAliveCheck ??
144144
this.mightGetEnv("SKIP_ALIVE_CHECK").toLowerCase() === "true"
145145

146-
// Check for F2F_APP mode (format: https://keyId:keySecret@host)
146+
// Check for F2F_APP mode (format: f2f://keyId:keySecret@host)
147147
const f2fAppRaw = options.f2fApp || this.mightGetEnv("F2F_APP")
148148
if (f2fAppRaw) {
149149
const f2fApp = new URL(f2fAppRaw)
150150
if (!f2fApp.username || !f2fApp.password) {
151151
console.log(
152-
"F2F_APP must contain credentials like: https://keyId:keySecret@app.first2find.nl",
152+
"F2F_APP must contain credentials, e.g. f2f://keyId:keySecret@app.first2find.nl",
153153
)
154154
process.exit(1)
155155
}
156156

157157
this.isAppMode = true
158-
this.appBaseUrl = f2fApp.origin
158+
this.appBaseUrl = "http://" + f2fApp.host
159159
this.appTokenManager = new AppTokenManager({
160160
url: this.appBaseUrl,
161161
keyId: f2fApp.username,
@@ -227,7 +227,7 @@ export class Server {
227227
const altApp = new URL(altAppRaw)
228228
if (!altApp.username || !altApp.password) {
229229
console.log(
230-
"F2F_ALTERNATIVE_APP must contain credentials like: https://keyId:keySecret@app.first2find.nl",
230+
"F2F_ALTERNATIVE_APP must contain credentials, e.g. f2f://keyId:keySecret@app.first2find.nl",
231231
)
232232
process.exit(1)
233233
}

0 commit comments

Comments
 (0)