Skip to content

Commit 5e5c5c1

Browse files
refactor(Cocoon/IPC): Migrate configuration service to class-based Effect-TS Context
- Transition IPC configuration from interface to class-based `Context.Tag` implementation in `Configuration.ts` - Update server imports and type references to use consolidated `ServerTag` from service layer - Aligns with ongoing architectural refactoring to fully leverage Effect-TS's dependency management system - Enhances type safety and consistency with Land's declarative service patterns by using native Context APIs - Prepares ground for unified configuration management across Mountain/Cocoon gRPC handshake sequence Refs #2746499
1 parent 8bdeb7c commit 5e5c5c1

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

Source/Service/IPC/Configuration.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@
66

77
import { Context } from "effect";
88

9-
/**
10-
* The configuration required for the IPC service.
11-
*/
12-
export interface Configuration {
13-
/**
14-
* The network address of the `Mountain` gRPC server.
15-
* @example "localhost:50051"
16-
*/
17-
readonly MountainAddress: string;
18-
/**
19-
* The network address where the `Cocoon` gRPC server should listen.
20-
* @example "localhost:50052"
21-
*/
22-
readonly CocoonAddress: string;
23-
}
24-
259
/**
2610
* The `Context.Tag` for the IPC configuration.
2711
*/
28-
export const Tag = Context.Tag("IPC/Configuration")<Configuration>;
12+
export class Configuration extends Context.Tag("IPC/Configuration")<
13+
Configuration,
14+
{
15+
/**
16+
* The network address of the `Mountain` gRPC server.
17+
* @example "localhost:50051"
18+
*/
19+
readonly MountainAddress: string;
20+
/**
21+
* The network address where the `Cocoon` gRPC server should listen.
22+
* @example "localhost:50052"
23+
*/
24+
readonly CocoonAddress: string;
25+
}
26+
>() {}

Source/Service/IPC/Server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import { Configuration } from "./Configuration.js";
1010
import { Dispatcher } from "./Dispatcher.js";
1111
import type { gRPCConnectionError } from "./Error.js";
1212
import { Acquire } from "./Server/Acquire.js";
13-
import { Tag, type Interface as ServerService } from "./Server/Service.js";
13+
import { Server as ServerTag } from "./Server/Service.js";
1414

1515
export namespace Server {
16-
export const Tag = Tag;
17-
export type Interface = ServerService;
16+
export const Tag = ServerTag;
17+
export type Interface = ServerTag;
1818
/**
1919
* The live implementation `Layer` for the gRPC Server service.
2020
*
@@ -26,6 +26,6 @@ export namespace Server {
2626
export const Live: Layer.Layer<
2727
Interface,
2828
gRPCConnectionError,
29-
Configuration.Configuration
29+
Configuration
3030
> = Layer.scoped(Tag, Acquire).pipe(Layer.provide(Dispatcher.Live));
3131
}

0 commit comments

Comments
 (0)