From 4503081dbf2b5e4d585d941bf294554922e3d1a4 Mon Sep 17 00:00:00 2001 From: Dmitry Muhomor Date: Wed, 23 Aug 2023 11:55:26 +0300 Subject: [PATCH] require device config name to match device name This is already the case for all device configs. --- src/config/device.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/config/device.ts b/src/config/device.ts index 382b1d2..6c9a9eb 100644 --- a/src/config/device.ts +++ b/src/config/device.ts @@ -2,6 +2,7 @@ // eslint-disable-next-line @typescript-eslint/triple-slash-reference /// +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) {