feat: add a way to escape hatch from strict config checking
This commit is contained in:
parent
868d85bbeb
commit
98ea2cb06f
@ -182,6 +182,18 @@ export async function loadConfig(path?: string) {
|
||||
const data = await readFile(path, 'utf8')
|
||||
configYaml = parseDocument(data)
|
||||
|
||||
if (process.env.HEADSCALE_CONFIG_UNSTRICT === 'true') {
|
||||
config = configYaml.toJSON() as HeadscaleConfig
|
||||
console.log('Loaded Headscale configuration in non-strict mode')
|
||||
console.log('By using this mode you forfeit GitHub issue support')
|
||||
console.log('This is very dangerous and comes with a few caveats:')
|
||||
console.log('- Headplane could very easily crash')
|
||||
console.log('- Headplane could break your Headscale installation')
|
||||
console.log('- The UI could throw random errors/show incorrect data')
|
||||
console.log('')
|
||||
return config
|
||||
}
|
||||
|
||||
try {
|
||||
config = await HeadscaleConfig.parseAsync(configYaml.toJSON())
|
||||
} catch (error) {
|
||||
@ -245,7 +257,10 @@ export async function patchConfig(partial: Record<string, unknown>) {
|
||||
configYaml.setIn(path, value)
|
||||
}
|
||||
|
||||
config = await HeadscaleConfig.parseAsync(configYaml.toJSON())
|
||||
config = process.env.HEADSCALE_CONFIG_UNSTRICT === 'true'
|
||||
? configYaml.toJSON() as HeadscaleConfig
|
||||
: (await HeadscaleConfig.parseAsync(configYaml.toJSON()))
|
||||
|
||||
const path = resolve(process.env.CONFIG_FILE ?? '/etc/headscale/config.yaml')
|
||||
await writeFile(path, configYaml.toString(), 'utf8')
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ You can configure Headplane using environment variables.
|
||||
- **`PORT`**: The port to bind the server to (default: `3000`).
|
||||
- **`CONFIG_FILE`**: The path to the Headscale `config.yaml` (default: `/etc/headscale/config.yaml`).
|
||||
- **`ACL_FILE`**: The path to the ACL file (default: `/etc/headscale/acl_policy.json`, not needed if you have `acl_policy_path` in your config).
|
||||
- **`HEADSCALE_CONFIG_UNSTRICT`**: This will disable the strict configuration loader (default: `false`).
|
||||
|
||||
#### Docker Integration
|
||||
The Docker integration allows Headplane to manage the Headscale docker container.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user