allow changing environment variables for edge functions on the command-line
Describe the bug
There is a requirement to be able to override the "Local development (Netlify CLI)" context for an environment variable set in the web UI at Netlify when using the CLI by setting the environment variable in the CLI's environment including the environment variables passed to the CLI process command via the shell like so:
EXAMPLE="value" netlify dev
Such an environment variable is passed to functions and the build command but not to the local edge function environment.
Being able to add or override the environment variable set in the UI is a requirement for some local testing use-cases.
Steps to reproduce
- Set an environment variable
EXAMPLEin the web UI and give it different values for each context:
- Link the local repo directory with the site using
netlify link. - Make an edge function for the site that
console.logs()the environment variableEXAMPLE(with something likeconsole.log("EXAMPLE is: ", Netlify.env.get("EXAMPLE")). - Start the development environment locally and override the environment variable using:
EXAMPLE="test" netlify dev. - Note that the environment variable
EXAMPLEstill is set todevelopmentand nottestin the local edge functions.
Configuration
N/A
Environment
System: OS: macOS 13.5 CPU: (10) arm64 Apple M1 Pro Memory: 2.75 GB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm npmGlobalPackages: netlify-cli: 15.9.1