Skip to content

Commit

Permalink
feat: allow to accept cloudflare notice (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
anbraten authored Oct 2, 2023
1 parent e8dd17c commit dd78b8e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface TunnelOptions {
hostname?: string;
protocol?: "http" | "https";
verifyTLS?: boolean;
acceptCloudflareNotice?: boolean;
}

export interface Tunnel {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit dd78b8e

Please sign in to comment.