Skip to content

Commit

Permalink
Make TRIGGER_REALTIME_STREAM_VERSION overridable by the project env v…
Browse files Browse the repository at this point in the history
…ars (#1543)
  • Loading branch information
ericallam authored Dec 10, 2024
1 parent 86b1628 commit 3afa42c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,25 @@ export async function resolveVariablesForEnvironment(runtimeEnvironment: Runtime
runtimeEnvironment.id
);

const overridableTriggerVariables = await resolveOverridableTriggerVariables(runtimeEnvironment);

const builtInVariables =
runtimeEnvironment.type === "DEVELOPMENT"
? await resolveBuiltInDevVariables(runtimeEnvironment)
: await resolveBuiltInProdVariables(runtimeEnvironment);

return [...projectSecrets, ...builtInVariables];
return [...overridableTriggerVariables, ...projectSecrets, ...builtInVariables];
}

async function resolveOverridableTriggerVariables(runtimeEnvironment: RuntimeEnvironment) {
let result: Array<EnvironmentVariable> = [
{
key: "TRIGGER_REALTIME_STREAM_VERSION",
value: env.REALTIME_STREAM_VERSION,
},
];

return result;
}

async function resolveBuiltInDevVariables(runtimeEnvironment: RuntimeEnvironment) {
Expand All @@ -684,10 +697,6 @@ async function resolveBuiltInDevVariables(runtimeEnvironment: RuntimeEnvironment
key: "TRIGGER_STREAM_URL",
value: env.STREAM_ORIGIN ?? env.API_ORIGIN ?? env.APP_ORIGIN,
},
{
key: "TRIGGER_REALTIME_STREAM_VERSION",
value: env.REALTIME_STREAM_VERSION,
},
];

if (env.DEV_OTEL_BATCH_PROCESSING_ENABLED === "1") {
Expand Down Expand Up @@ -758,10 +767,6 @@ async function resolveBuiltInProdVariables(runtimeEnvironment: RuntimeEnvironmen
key: "TRIGGER_ORG_ID",
value: runtimeEnvironment.organizationId,
},
{
key: "TRIGGER_REALTIME_STREAM_VERSION",
value: env.REALTIME_STREAM_VERSION,
},
];

if (env.PROD_OTEL_BATCH_PROCESSING_ENABLED === "1") {
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/v3/runMetadata/metadataStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export class MetadataStream<T> {
private initializeServerStream(): Promise<void | Response> {
const serverIterator = this.serverIterator;

// TODO: Why is this only sending stuff to the server at the end of the run?
const serverStream = new ReadableStream({
async pull(controller) {
try {
Expand Down

0 comments on commit 3afa42c

Please sign in to comment.