require device config name to match device name

This is already the case for all device configs.
This commit is contained in:
Dmitry Muhomor 2023-08-23 11:55:26 +03:00 committed by Daniel Micay
parent 65e3e84583
commit 4503081dbf

View file

@ -2,6 +2,7 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
///<reference path="../util/jstypes.d.ts" />
import assert from 'assert'
import path from 'path'
import { loadAndMergeConfig } from './config-loader'
@ -122,6 +123,9 @@ export async function loadDeviceConfigs(configPath: string) {
delete merged.type
if (type == ConfigType.Device) {
let configName = path.basename(configPath, '.yml')
let deviceName = merged.device.name
assert(configName === deviceName, `config name doesn't match device name (${deviceName}): ${configPath}`)
return [merged as DeviceConfig]
}
if (type == ConfigType.DeviceList) {