From 98c81535559265af114075bb6bae76374caf3114 Mon Sep 17 00:00:00 2001 From: Nicolas Penin Date: Sun, 17 Nov 2024 18:23:19 +0100 Subject: [PATCH] fix: handle start from fork --- .../src/server/commands/device-types/$init.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/devices/src/server/commands/device-types/$init.ts b/packages/devices/src/server/commands/device-types/$init.ts index 50921308b..b775fc665 100644 --- a/packages/devices/src/server/commands/device-types/$init.ts +++ b/packages/devices/src/server/commands/device-types/$init.ts @@ -24,7 +24,14 @@ export default async function (this: devices.DeviceTypeState, context: CliContex } this.initializing = []; this.types = {}; - if (!context.state.has('devicetype')) - context.state.set('devicetype', {}); - Object.assign(this, await app<{ DeviceInit: DbSet<{ name: string, body: any }> }>(context, context.state.get('devicetype'), pm)); + let config: ProxyConfiguration; + if (!context.state) + config = Configuration.new('./devicetype.json', {}); + else + { + if (!context.state.has('devicetype')) + context.state.set('devicetype', {}); + config = context.state.get('devicetype') + } + Object.assign(this, await app<{ DeviceInit: DbSet<{ name: string, body: any }> }>(context, config, pm)); } \ No newline at end of file