(raw: string | undefined)
| 125 | } |
| 126 | |
| 127 | export function parseLogLevel(raw: string | undefined): ServerLogLevel { |
| 128 | if (raw === undefined) return DEFAULT_LOG_LEVEL; |
| 129 | if ((VALID_LOG_LEVELS as readonly string[]).includes(raw)) { |
| 130 | return raw as ServerLogLevel; |
| 131 | } |
| 132 | throw new Error( |
| 133 | `error: invalid --log-level value: ${raw} (allowed: ${VALID_LOG_LEVELS.join(', ')})`, |
| 134 | ); |
| 135 | } |
| 136 | |
| 137 | export function serverOrigin(host: string, port: number): string { |
| 138 | return `http://${host}:${port}`; |
no outgoing calls
no test coverage detected