Skip to content

Commit 09b21e0

Browse files
authored
fix: merge legacy and primary tunnel config (#4)
1 parent f473e53 commit 09b21e0

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,18 @@ function normalizeConfig(data: unknown): Partial<TunnelConfig> {
5454
}
5555

5656
function readConfigFile(dir: string): Partial<TunnelConfig> {
57-
for (const fileName of [PRIMARY_CONFIG_FILE, LEGACY_CONFIG_FILE]) {
57+
const merged: Partial<TunnelConfig> = {};
58+
59+
for (const fileName of [LEGACY_CONFIG_FILE, PRIMARY_CONFIG_FILE]) {
5860
try {
5961
const raw = readFileSync(resolve(dir, fileName), "utf-8");
60-
return normalizeConfig(JSON.parse(raw));
62+
Object.assign(merged, normalizeConfig(JSON.parse(raw)));
6163
} catch {
6264
// Try next candidate.
6365
}
6466
}
6567

66-
return {};
68+
return merged;
6769
}
6870

6971
function parseArgs(argv: string[]): Partial<TunnelConfig> {

0 commit comments

Comments
 (0)