Skip to content

Commit 14c95f7

Browse files
BunsDevCopilot
andauthored
Update apps/server/src/persistence/Layers/OpenclawGatewayConfig.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d3f0dec commit 14c95f7

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

apps/server/src/persistence/Layers/OpenclawGatewayConfig.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,16 +339,20 @@ export const OpenclawGatewayConfigLive = Layer.effect(
339339
: input.sharedSecret?.trim() !== undefined && input.sharedSecret.trim().length > 0
340340
? input.sharedSecret.trim()
341341
: existing?.sharedSecret;
342-
const generatedIdentity = fromGeneratedIdentity(generateOpenclawDeviceIdentity());
343-
const identity = existing ?? {
344-
...generatedIdentity,
345-
deviceToken: undefined,
346-
deviceTokenRole: undefined,
347-
deviceTokenScopes: [],
348-
updatedAt: new Date().toISOString(),
349-
gatewayUrl: input.gatewayUrl,
350-
sharedSecret,
351-
};
342+
const identity =
343+
existing ??
344+
(() => {
345+
const generatedIdentity = fromGeneratedIdentity(generateOpenclawDeviceIdentity());
346+
return {
347+
...generatedIdentity,
348+
deviceToken: undefined,
349+
deviceTokenRole: undefined,
350+
deviceTokenScopes: [],
351+
updatedAt: new Date().toISOString(),
352+
gatewayUrl: input.gatewayUrl,
353+
sharedSecret,
354+
};
355+
})();
352356
const nextConfig = makeStoredConfig({
353357
gatewayUrl: input.gatewayUrl,
354358
sharedSecret,

0 commit comments

Comments
 (0)