chore: format to 2-space and bump changelog
This commit is contained in:
1 parent
a67f4db5e2
commit
e5f677803f
81 files changed
+7086
-6999
No files matched your search
+52
-52
@@ -4,60 +4,60 @@ import type { RuntimeEnv } from "../runtime.js";
|
||||
import { upCommand } from "./up.js";
|
||||
|
||||
export async function webhookCommand(
|
||||
opts: {
|
||||
port: string;
|
||||
path: string;
|
||||
reply?: string;
|
||||
verbose?: boolean;
|
||||
yes?: boolean;
|
||||
ingress?: "tailscale" | "none";
|
||||
dryRun?: boolean;
|
||||
},
|
||||
deps: CliDeps,
|
||||
runtime: RuntimeEnv,
|
||||
opts: {
|
||||
port: string;
|
||||
path: string;
|
||||
reply?: string;
|
||||
verbose?: boolean;
|
||||
yes?: boolean;
|
||||
ingress?: "tailscale" | "none";
|
||||
dryRun?: boolean;
|
||||
},
|
||||
deps: CliDeps,
|
||||
runtime: RuntimeEnv,
|
||||
) {
|
||||
const port = Number.parseInt(opts.port, 10);
|
||||
if (Number.isNaN(port) || port <= 0 || port >= 65536) {
|
||||
throw new Error("Port must be between 1 and 65535");
|
||||
}
|
||||
const port = Number.parseInt(opts.port, 10);
|
||||
if (Number.isNaN(port) || port <= 0 || port >= 65536) {
|
||||
throw new Error("Port must be between 1 and 65535");
|
||||
}
|
||||
|
||||
const ingress = opts.ingress ?? "tailscale";
|
||||
const ingress = opts.ingress ?? "tailscale";
|
||||
|
||||
// Tailscale ingress: reuse the `up` flow (Funnel + Twilio webhook update).
|
||||
if (ingress === "tailscale") {
|
||||
const result = await upCommand(
|
||||
{
|
||||
port: opts.port,
|
||||
path: opts.path,
|
||||
verbose: opts.verbose,
|
||||
yes: opts.yes,
|
||||
dryRun: opts.dryRun,
|
||||
},
|
||||
deps,
|
||||
runtime,
|
||||
);
|
||||
return result.server;
|
||||
}
|
||||
// Tailscale ingress: reuse the `up` flow (Funnel + Twilio webhook update).
|
||||
if (ingress === "tailscale") {
|
||||
const result = await upCommand(
|
||||
{
|
||||
port: opts.port,
|
||||
path: opts.path,
|
||||
verbose: opts.verbose,
|
||||
yes: opts.yes,
|
||||
dryRun: opts.dryRun,
|
||||
},
|
||||
deps,
|
||||
runtime,
|
||||
);
|
||||
return result.server;
|
||||
}
|
||||
|
||||
// Local-only webhook (no ingress / no Twilio update).
|
||||
await deps.ensurePortAvailable(port);
|
||||
if (opts.reply === "dry-run" || opts.dryRun) {
|
||||
runtime.log(
|
||||
`[dry-run] would start webhook on port ${port} path ${opts.path}`,
|
||||
);
|
||||
return undefined;
|
||||
}
|
||||
const server = await retryAsync(
|
||||
() =>
|
||||
deps.startWebhook(
|
||||
port,
|
||||
opts.path,
|
||||
opts.reply,
|
||||
Boolean(opts.verbose),
|
||||
runtime,
|
||||
),
|
||||
3,
|
||||
300,
|
||||
);
|
||||
return server;
|
||||
// Local-only webhook (no ingress / no Twilio update).
|
||||
await deps.ensurePortAvailable(port);
|
||||
if (opts.reply === "dry-run" || opts.dryRun) {
|
||||
runtime.log(
|
||||
`[dry-run] would start webhook on port ${port} path ${opts.path}`,
|
||||
);
|
||||
return undefined;
|
||||
}
|
||||
const server = await retryAsync(
|
||||
() =>
|
||||
deps.startWebhook(
|
||||
port,
|
||||
opts.path,
|
||||
opts.reply,
|
||||
Boolean(opts.verbose),
|
||||
runtime,
|
||||
),
|
||||
3,
|
||||
300,
|
||||
);
|
||||
return server;
|
||||
}
|
||||
Reference in new issue
Block a user