mirror of
https://github.com/tale/headplane.git
synced 2026-09-01 17:58:25 +00:00
fix: when not using dns_records_path, use config dns editor
This commit is contained in:
@@ -77,7 +77,7 @@ export class HeadscaleDNSConfig {
|
|||||||
|
|
||||||
export async function loadHeadscaleDNS(path?: string) {
|
export async function loadHeadscaleDNS(path?: string) {
|
||||||
if (!path) {
|
if (!path) {
|
||||||
return new HeadscaleDNSConfig('no');
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug('config', 'Loading Headscale DNS configuration file: %s', path);
|
log.debug('config', 'Loading Headscale DNS configuration file: %s', path);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { constants, access, readFile, writeFile } from 'node:fs/promises';
|
import { constants, access, readFile, writeFile } from 'node:fs/promises';
|
||||||
|
import { exit } from 'node:process';
|
||||||
import { setTimeout } from 'node:timers/promises';
|
import { setTimeout } from 'node:timers/promises';
|
||||||
import { type } from 'arktype';
|
import { type } from 'arktype';
|
||||||
import { Document, parseDocument } from 'yaml';
|
import { Document, parseDocument } from 'yaml';
|
||||||
@@ -269,6 +270,23 @@ export async function loadHeadscaleConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dns = await loadHeadscaleDNS(dnsPath);
|
const dns = await loadHeadscaleDNS(dnsPath);
|
||||||
|
if (dns && !config.dns.extra_records_path) {
|
||||||
|
log.error(
|
||||||
|
'config',
|
||||||
|
'Using separate DNS config file but dns.extra_records_path is not set in Headscale config',
|
||||||
|
);
|
||||||
|
log.error(
|
||||||
|
'config',
|
||||||
|
'Please set `dns.extra_records_path` in the Headscale config',
|
||||||
|
);
|
||||||
|
log.error(
|
||||||
|
'config',
|
||||||
|
'Or remove `headscale.dns_records_path` from the Headplane config',
|
||||||
|
);
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
return new HeadscaleConfig(w ? 'rw' : 'ro', dns, config, document, path);
|
return new HeadscaleConfig(w ? 'rw' : 'ro', dns, config, document, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user