Skip to content

Commit 2128973

Browse files
committed
fix: properly utilize cleanup
1 parent 51d56d2 commit 2128973

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

bin/cli.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ interface ReverseProxyOption {
1212
keyPath: string
1313
certPath: string
1414
caCertPath: string
15-
etcHostsCleanup: boolean
15+
cleanup: {
16+
certs: boolean
17+
hosts: boolean
18+
}
1619
verbose: boolean
1720
}
1821

@@ -23,7 +26,8 @@ cli
2326
.option('--key-path <path>', 'Absolute path to the SSL key')
2427
.option('--cert-path <path>', 'Absolute path to the SSL certificate')
2528
.option('--ca-cert-path <path>', 'Absolute path to the SSL CA certificate')
26-
.option('--etc-hosts-cleanup', 'Cleanup /etc/hosts on exit')
29+
.option('--hosts-cleanup', 'Cleanup /etc/hosts on exit')
30+
.option('--certs-cleanup', 'Cleanup SSL certificates on exit')
2731
.option('--verbose', 'Enable verbose logging')
2832
.example('reverse-proxy start --from localhost:5173 --to my-project.localhost')
2933
.example('reverse-proxy start --from localhost:3000 --to my-project.localhost/api')
@@ -38,7 +42,10 @@ cli
3842
from: options?.from,
3943
to: options?.to,
4044
https: httpsConfig(options),
41-
etcHostsCleanup: options?.etcHostsCleanup,
45+
cleanup: {
46+
certs: options?.cleanup.certs,
47+
hosts: options?.cleanup.hosts,
48+
},
4249
verbose: options?.verbose,
4350
})
4451
})

src/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ export const defaultConfig: ReverseProxyConfig = {
1313
certPath: join(homedir(), '.stacks', 'ssl', `stacks.localhost.crt`),
1414
keyPath: join(homedir(), '.stacks', 'ssl', `stacks.localhost.crt.key`),
1515
},
16-
etcHostsCleanup: true,
16+
cleanup: {
17+
certs: false,
18+
hosts: false,
19+
},
1720
vitePluginUsage: false,
1821
verbose: true,
1922
}

0 commit comments

Comments
 (0)