Skip to content

Commit fc79b2e

Browse files
wconrad265tlane25
andcommitted
fix: build getEnvelope context
fixed issue where build was not injecting env variables that were not dev or all context Co-authored-by: Thomas Lane <[email protected]>
1 parent b6fec29 commit fc79b2e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/config/src/env/envelope.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ export const getEnvelope = async function ({
1717
try {
1818
const environmentVariables = await (api as any).getEnvVars({ accountId, siteId, context_name: context })
1919

20-
const sortedEnvVarsFromDevContext = environmentVariables
20+
const sortedEnvVarsFromContext = environmentVariables
2121
.sort((left, right) => (left.key.toLowerCase() < right.key.toLowerCase() ? -1 : 1))
2222
.reduce((acc, cur) => {
23-
const envVar = cur.values.find((val) => ['dev', 'all'].includes(val.context))
23+
const envVar = cur.values.find((val) => ['all', context].includes(val.context))
2424
if (envVar && envVar.value) {
2525
return {
2626
...acc,
@@ -29,7 +29,7 @@ export const getEnvelope = async function ({
2929
}
3030
return acc
3131
}, {})
32-
return sortedEnvVarsFromDevContext
32+
return sortedEnvVarsFromContext
3333
} catch {
3434
return {}
3535
}

packages/config/src/env/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const getAccountEnv = async function ({
181181
context?: string
182182
}) {
183183
if (siteInfo.use_envelope) {
184-
const envelope = await getEnvelope({ api, accountId: siteInfo.account_slug, context })
184+
const envelope = await getEnvelope({ api, accountId: siteInfo.account_slug, siteId: siteInfo.site_id, context })
185185
return envelope
186186
}
187187
const { site_env: siteEnv = {} } = accounts.find(({ slug }) => slug === siteInfo.account_slug) || {}

0 commit comments

Comments
 (0)