History

Unwrap secret store options at call sites

Cursor Agent committed 5 months ago

Commit 0f9d8581 parent 8e7cf432 files · +8 −3Browse files

Unified · Split

2 files
  1. apps/server/src/auth/Layers/ServerSecretStore.test.ts +3 −2
  2. apps/server/src/serverSettings.ts +5 −1
apps/server/src/auth/Layers/ServerSecretStore.test.ts+3−2
@@ -208,8 +208,9 @@ it.layer(NodeServices.layer)("ServerSecretStoreLive", (it) => { · 207 unmodified lines
208 const persisted = yield* secretStore.get("session-signing-key");208 const persisted = yield* secretStore.get("session-signing-key");
209 209
210 assert.isTrue(Option.isSome(persisted));210 assert.isTrue(Option.isSome(persisted));
211 assert.deepEqual(Array.from(first), Array.from(persisted.value));211 const persistedBytes = Option.getOrThrow(persisted);
212 assert.deepEqual(Array.from(second), Array.from(persisted.value));212 assert.deepEqual(Array.from(first), Array.from(persistedBytes));
213 assert.deepEqual(Array.from(second), Array.from(persistedBytes));
213 }).pipe(Effect.provide(makeConcurrentCreateSecretStoreLayer())),214 }).pipe(Effect.provide(makeConcurrentCreateSecretStoreLayer())),
214 );215 );
215 216
apps/server/src/serverSettings.ts+5−1
@@ -31,6 +31,7 @@ import * as Effect from "effect/Effect"; · 30 unmodified lines
31import * as Exit from "effect/Exit";31import * as Exit from "effect/Exit";
32import * as FileSystem from "effect/FileSystem";32import * as FileSystem from "effect/FileSystem";
33import * as Layer from "effect/Layer";33import * as Layer from "effect/Layer";
34import * as Option from "effect/Option";
34import * as Path from "effect/Path";35import * as Path from "effect/Path";
35import * as Equal from "effect/Equal";36import * as Equal from "effect/Equal";
36import * as PubSub from "effect/PubSub";37import * as PubSub from "effect/PubSub";
@@ -349,7 +350,10 @@ const makeServerSettings = Effect.gen(function* () { · 312 unmodified lines
349 );350 );
350 environment.push({351 environment.push({
351 ...variable,352 ...variable,
352 value: secret ? textDecoder.decode(secret) : "",353 value: Option.match(secret, {
354 onSome: (bytes) => textDecoder.decode(bytes),
355 onNone: () => "",
356 }),
353 });357 });
354 }358 }
355 providerInstances[instanceId] = {359 providerInstances[instanceId] = {