Add server runtime and hello handshake
This commit is contained in:
@@ -48,10 +48,10 @@ function isValidWsUrl(value: string): boolean {
|
||||
}
|
||||
|
||||
export function validateYonexusServerConfig(raw: unknown): YonexusServerConfig {
|
||||
const source = raw as Record<string, unknown> | null;
|
||||
const source = (raw && typeof raw === "object" ? raw : {}) as Record<string, unknown>;
|
||||
const issues: string[] = [];
|
||||
|
||||
const rawIdentifiers = source?.followerIdentifiers;
|
||||
const rawIdentifiers = source.followerIdentifiers;
|
||||
const followerIdentifiers = Array.isArray(rawIdentifiers)
|
||||
? rawIdentifiers
|
||||
.filter((value): value is string => typeof value === "string")
|
||||
@@ -67,23 +67,23 @@ export function validateYonexusServerConfig(raw: unknown): YonexusServerConfig {
|
||||
issues.push("followerIdentifiers must not contain duplicates");
|
||||
}
|
||||
|
||||
const notifyBotToken = source?.notifyBotToken;
|
||||
const notifyBotToken = source.notifyBotToken;
|
||||
if (!isNonEmptyString(notifyBotToken)) {
|
||||
issues.push("notifyBotToken is required");
|
||||
}
|
||||
|
||||
const adminUserId = source?.adminUserId;
|
||||
const adminUserId = source.adminUserId;
|
||||
if (!isNonEmptyString(adminUserId)) {
|
||||
issues.push("adminUserId is required");
|
||||
}
|
||||
|
||||
const listenPort = source?.listenPort;
|
||||
const listenPort = source.listenPort;
|
||||
if (!isValidPort(listenPort)) {
|
||||
issues.push("listenPort must be an integer between 1 and 65535");
|
||||
}
|
||||
|
||||
const listenHost = normalizeOptionalString(source?.listenHost) ?? "0.0.0.0";
|
||||
const publicWsUrl = normalizeOptionalString(source?.publicWsUrl);
|
||||
const listenHost = normalizeOptionalString(source.listenHost) ?? "0.0.0.0";
|
||||
const publicWsUrl = normalizeOptionalString(source.publicWsUrl);
|
||||
|
||||
if (publicWsUrl !== undefined && !isValidWsUrl(publicWsUrl)) {
|
||||
issues.push("publicWsUrl must be a valid ws:// or wss:// URL when provided");
|
||||
|
||||
Reference in New Issue
Block a user