-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: when fetching env from envelope, pass context #5426
Conversation
This pull request adds or modifies JavaScript ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor suggestion and a question just to ensure we keep the currently compatibility. LGTM overall.
if (accountId === undefined) { | ||
return {} | ||
} | ||
try { | ||
const environmentVariables = await api.getEnvVars({ accountId, siteId }) | ||
const environmentVariables = await (api as any).getEnvVars({ accountId, siteId, context_name: context }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm understanding correctly based on the tests, in the absence of a context
this will apply the default
value which will be production
meaning the current behaviour is maintained?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coooorect!
packages/config/src/env/main.ts
Outdated
@@ -91,7 +99,7 @@ const getGeneralEnv = async function ({ | |||
context, | |||
}) { | |||
const gitEnv = await getGitEnv(buildDir, branch) | |||
const deployUrls = getDeployUrls({ siteInfo, branch, deployId }) | |||
const deployUrls = getDeployUrls({ siteInfo: siteInfo as any, branch, deployId }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know these any
's we're adding result from the untyped API but maybe we can wrap this is these nice TSFixme thingy?
type $TSFixme = any
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call, done in 972ca05
Currently, we're always doing an extra Envelope fetch in the CLI for
ntl build
/ntl dev
. We do this because@netlify/config
didn't consider the context when fetching from Envelope. Time to change that, so we can get rid that workaround in the CLI!