diff --git a/README.md b/README.md index b81f034..2970322 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,7 @@ The following command line options are available for the `start` command: | Option | Description | Default | Alias | | -------------- | ----------------------------------------------------------------------------- | ---------- | ----- | | --port | Port to listen on | 4141 | -p | +| --listen | Interface to bind to (0.0.0.0 for all interfaces, 127.0.0.1 for localhost only) | 0.0.0.0 | -l | | --verbose | Enable verbose logging | false | -v | | --account-type | Account type to use (individual, business, enterprise) | individual | -a | | --manual | Enable manual request approval | false | none | diff --git a/src/start.ts b/src/start.ts index 46798ad..c10bc83 100644 --- a/src/start.ts +++ b/src/start.ts @@ -15,6 +15,7 @@ import { server } from "./server" interface RunServerOptions { port: number + listen: string verbose: boolean accountType: string manual: boolean @@ -111,6 +112,7 @@ export async function runServer(options: RunServerOptions): Promise { serve({ fetch: server.fetch as ServerHandler, port: options.port, + hostname: options.listen, }) } @@ -126,6 +128,13 @@ export const start = defineCommand({ default: "4141", description: "Port to listen on", }, + listen: { + alias: "l", + type: "string", + default: "0.0.0.0", + description: + "Interface to bind to (0.0.0.0 for all interfaces, 127.0.0.1 for localhost only)", + }, verbose: { alias: "v", type: "boolean", @@ -182,6 +191,7 @@ export const start = defineCommand({ return runServer({ port: Number.parseInt(args.port, 10), + listen: args.listen, verbose: args.verbose, accountType: args["account-type"], manual: args.manual,