Remove env-based tunnel toggle

This commit is contained in:
weishu
2026-01-13 20:32:47 +08:00
parent 5defb6dbfc
commit e0c36b71e6
5 changed files with 29 additions and 39 deletions
+3 -11
View File
@@ -1,8 +1,8 @@
import chalk from 'chalk'
import type { CommandDefinition, CommandContext } from './types'
function parseServerArgs(args: string[]): { host?: string; port?: string; relay?: boolean } {
const result: { host?: string; port?: string; relay?: boolean } = {}
function parseServerArgs(args: string[]): { host?: string; port?: string } {
const result: { host?: string; port?: string } = {}
for (let i = 0; i < args.length; i++) {
const arg = args[i]
@@ -14,10 +14,6 @@ function parseServerArgs(args: string[]): { host?: string; port?: string; relay?
result.host = arg.slice('--host='.length)
} else if (arg.startsWith('--port=')) {
result.port = arg.slice('--port='.length)
} else if (arg === '--relay') {
result.relay = true
} else if (arg === '--no-relay') {
result.relay = false
}
}
@@ -29,7 +25,7 @@ export const serverCommand: CommandDefinition = {
requiresRuntimeAssets: false,
run: async (context: CommandContext) => {
try {
const { host, port, relay } = parseServerArgs(context.commandArgs)
const { host, port } = parseServerArgs(context.commandArgs)
if (host) {
process.env.WEBAPP_HOST = host
@@ -37,10 +33,6 @@ export const serverCommand: CommandDefinition = {
if (port) {
process.env.WEBAPP_PORT = port
}
if (relay !== undefined) {
process.env.HAPI_RELAY = relay ? 'true' : 'false'
}
await import('../../../server/src/index')
} catch (error) {
console.error(chalk.red('Error:'), error instanceof Error ? error.message : 'Unknown error')