fix(relay): read stage from worker stack context
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
56009d5a5b
commit
d3d36a1d3a
3 files changed
+38
-2
No files matched your search
@@ -20,7 +20,7 @@ const relayRecentSpansQuery = (dataset: string) =>
|
||||
].join("\n");
|
||||
|
||||
export const RelayObservability = Effect.gen(function* () {
|
||||
const stage = yield* Alchemy.Stage;
|
||||
const { stage } = yield* Alchemy.Stack;
|
||||
const traces = yield* Axiom.Dataset("RelayTracesDataset", {
|
||||
name: relayResourceNameForStage("t3-code-relay-traces", stage),
|
||||
kind: "otel:traces:v1",
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import * as Alchemy from "alchemy";
|
||||
import * as ConfigProvider from "effect/ConfigProvider";
|
||||
import * as Effect from "effect/Effect";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { RelayDeploymentConfig } from "./zone.ts";
|
||||
|
||||
describe("RelayDeploymentConfig", () => {
|
||||
it("reads the stage from the stack context available in the Worker runtime", async () => {
|
||||
const config = await Effect.runPromise(
|
||||
RelayDeploymentConfig.pipe(
|
||||
Effect.provideService(Alchemy.Stack, {
|
||||
name: "T3CodeRelay",
|
||||
stage: "dev_julius",
|
||||
bindings: {},
|
||||
resources: {},
|
||||
actions: {},
|
||||
}),
|
||||
Effect.provide(
|
||||
ConfigProvider.layer(
|
||||
ConfigProvider.fromUnknown({
|
||||
RELAY_ZONE_NAME: "example.com",
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(config).toEqual({
|
||||
stage: "dev_julius",
|
||||
relayPublicDomain: "relay-dev-julius.example.com",
|
||||
relayPublicOrigin: "https://relay-dev-julius.example.com",
|
||||
managedEndpointZoneName: "example.com",
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -8,7 +8,7 @@ import * as Option from "effect/Option";
|
||||
import { relayPublicDomainForStage } from "./deploymentConfig.ts";
|
||||
|
||||
export const RelayDeploymentConfig = Effect.gen(function* () {
|
||||
const stage = yield* Alchemy.Stage;
|
||||
const { stage } = yield* Alchemy.Stack;
|
||||
const managedEndpointZoneName = yield* Config.nonEmptyString("RELAY_ZONE_NAME");
|
||||
const relayPublicDomainOverride = yield* Config.nonEmptyString("RELAY_DOMAIN").pipe(
|
||||
Config.option,
|
||||
|
||||
Reference in new issue
Block a user