Skip to content

Commit 686100d

Browse files
xesrevinuGit Agent
andcommitted
refactor(config): change gen to fn for consistency
- Replaced Effect.gen with Effect.fn in several functions. - Improved consistency across configuration modules. Updated function definitions from Effect.gen to Effect.fn for better code consistency in configuration files. This enhances readability and aligns with modern practices. Co-Authored-By: Git Agent <noreply@git-agent.dev>
1 parent d7400b4 commit 686100d

4 files changed

Lines changed: 353 additions & 324 deletions

File tree

src/config/env.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ export const envOptionalString = (name: string) => Config.option(envString(name)
1111
export const envStringWithDefault = (name: string, fallback: string) =>
1212
envString(name).pipe(Config.withDefault(fallback));
1313

14-
const readPreferredEnv = (names: ReadonlyArray<string>, fallback: string) =>
15-
Effect.gen(function* () {
16-
for (const name of names) {
17-
const value = yield* envOptionalString(name);
18-
if (Option.isSome(value) && value.value.trim().length > 0) {
19-
return value.value.trim();
20-
}
14+
const readPreferredEnv = Effect.fn(function* (names: ReadonlyArray<string>, fallback: string) {
15+
for (const name of names) {
16+
const value = yield* envOptionalString(name);
17+
if (Option.isSome(value) && value.value.trim().length > 0) {
18+
return value.value.trim();
2119
}
22-
return fallback;
23-
});
20+
}
21+
return fallback;
22+
});
2423

2524
export const buildEnvironment = Effect.gen(function* () {
2625
const apiKey = yield* readPreferredEnv(["OPENAI_COMPACT_API_KEY", "GIT_AGENT_BUILD_API_KEY"], "");

0 commit comments

Comments
 (0)