mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 18:30:39 +09:00
Harden tailnet bind setup
This commit is contained in:
parent
6208899d0a
commit
a77206812e
6 changed files with 88 additions and 8 deletions
|
|
@ -2,11 +2,10 @@ import * as p from "@clack/prompts";
|
|||
import { isLoopbackHost, type BindMode } from "@paperclipai/shared";
|
||||
import type { AuthConfig, ServerConfig } from "../config/schema.js";
|
||||
import { parseHostnameCsv } from "../config/hostnames.js";
|
||||
import {
|
||||
buildCustomServerConfig,
|
||||
buildPresetServerConfig,
|
||||
inferConfiguredBind,
|
||||
} from "../config/server-bind.js";
|
||||
import { buildCustomServerConfig, buildPresetServerConfig, inferConfiguredBind } from "../config/server-bind.js";
|
||||
|
||||
const TAILNET_BIND_WARNING =
|
||||
"No Tailscale address was detected during setup. The saved config will stay on loopback until Tailscale is available or PAPERCLIP_TAILNET_BIND_HOST is set.";
|
||||
|
||||
function cancelled(): never {
|
||||
p.cancel("Setup cancelled.");
|
||||
|
|
@ -95,11 +94,15 @@ export async function promptServer(opts?: {
|
|||
|
||||
if (p.isCancel(allowedHostnamesInput)) cancelled();
|
||||
|
||||
return buildPresetServerConfig(bind, {
|
||||
const preset = buildPresetServerConfig(bind, {
|
||||
port,
|
||||
allowedHostnames: parseHostnameCsv(allowedHostnamesInput),
|
||||
serveUi,
|
||||
});
|
||||
if (bind === "tailnet" && isLoopbackHost(preset.server.host)) {
|
||||
p.log.warn(TAILNET_BIND_WARNING);
|
||||
}
|
||||
return preset;
|
||||
}
|
||||
|
||||
const deploymentModeSelection = await p.select({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue