diff --git a/src/tunnel.ts b/src/tunnel.ts index 666a0d2..8478a13 100644 --- a/src/tunnel.ts +++ b/src/tunnel.ts @@ -7,6 +7,7 @@ export interface TunnelOptions { hostname?: string; protocol?: "http" | "https"; verifyTLS?: boolean; + acceptCloudflareNotice?: boolean; } export interface Tunnel { @@ -34,12 +35,15 @@ export async function startTunnel( if (!existsSync(cloudflaredBinPath)) { consola.log(cloudflaredNotice); - const canInstall = await consola.prompt( - `Do you agree with the above terms and wish to install the binary from GitHub?`, - { - type: "confirm", - }, - ); + const canInstall = + opts.acceptCloudflareNotice || + process.env.UNTUN_ACCEPT_CLOUDFLARE_NOTICE || + (await consola.prompt( + `Do you agree with the above terms and wish to install the binary from GitHub?`, + { + type: "confirm", + }, + )); if (!canInstall) { consola.fail("Skipping tunnel setup."); return;