mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
Remove env-based tunnel toggle
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user