Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/config/src/env/envelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export const getEnvelope = async function ({
try {
const environmentVariables = await (api as any).getEnvVars({ accountId, siteId, context_name: context })

const sortedEnvVarsFromDevContext = environmentVariables
const sortedEnvVarsFromContext = environmentVariables
.sort((left, right) => (left.key.toLowerCase() < right.key.toLowerCase() ? -1 : 1))
.reduce((acc, cur) => {
const envVar = cur.values.find((val) => ['dev', 'all'].includes(val.context))
const envVar = cur.values.find((val) => ['all', context].includes(val.context))
if (envVar && envVar.value) {
return {
...acc,
Expand All @@ -29,7 +29,7 @@ export const getEnvelope = async function ({
}
return acc
}, {})
return sortedEnvVarsFromDevContext
return sortedEnvVarsFromContext
} catch {
return {}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/config/src/env/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const getAccountEnv = async function ({
context?: string
}) {
if (siteInfo.use_envelope) {
const envelope = await getEnvelope({ api, accountId: siteInfo.account_slug, context })
const envelope = await getEnvelope({ api, accountId: siteInfo.account_slug, siteId: siteInfo.site_id, context })
return envelope
}
const { site_env: siteEnv = {} } = accounts.find(({ slug }) => slug === siteInfo.account_slug) || {}
Expand Down