refactor: centralize bootstrap profile handling

This commit is contained in:
Peter Steinberger
2026-03-23 00:14:10 -07:00
parent 43557668d2
commit 6686f1cb2c
5 changed files with 129 additions and 46 deletions

View File

@@ -13,6 +13,7 @@ import {
pickMatchingExternalInterfaceAddress,
safeNetworkInterfaces,
} from "../infra/network-interfaces.js";
import { PAIRING_SETUP_BOOTSTRAP_PROFILE } from "../shared/device-bootstrap-profile.js";
import { resolveGatewayBindUrl } from "../shared/gateway-bind-url.js";
import { isCarrierGradeNatIpv4Address, isRfc1918Ipv4Address } from "../shared/net/ip.js";
import { resolveTailnetHostWithRunner } from "../shared/tailscale-status.js";
@@ -22,9 +23,6 @@ export type PairingSetupPayload = {
bootstrapToken: string;
};
const PAIRING_SETUP_BOOTSTRAP_ROLES = ["node"] as const;
const PAIRING_SETUP_BOOTSTRAP_SCOPES: string[] = [];
export type PairingSetupCommandResult = {
code: number | null;
stdout: string;
@@ -387,8 +385,7 @@ export async function resolvePairingSetupFromConfig(
bootstrapToken: (
await issueDeviceBootstrapToken({
baseDir: options.pairingBaseDir,
roles: PAIRING_SETUP_BOOTSTRAP_ROLES,
scopes: PAIRING_SETUP_BOOTSTRAP_SCOPES,
profile: PAIRING_SETUP_BOOTSTRAP_PROFILE,
})
).token,
},