Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
netlify-plugin-contextual-env
Advanced tools
Changelog
Readme
This plugin swaps out ENV vars on Netlify at build time. Here's how it works:
Say you have an ENV in your API code called DATABASE_URL
. If you use this plugin, you'll be able to override that value based on a Context or Branch name.
For example:
staging
branch, would automatically set DATABASE_URL
to the value of STAGING_DATABASE_URL
if it exists.production
context would automatically set DATABASE_URL
to the value of PRODUCTION_DATABASE_URL
if it exists.deploy-preview
context (used for Pull Requests) would automatically set DATABASE_URL
to the value of DEPLOY_PREVIEW_DATABASE_URL
if it exists.This allows you to have per-environment or per-context environment variables, without exposing those variables in your netlify.toml
config.
If you'd rather use a suffix rather than the default prefix configuration, pass suffix to the inputs below.
For the examples above, it would use the values DATABASE_URL_STAGING
, DATABASE_URL_PRODUCTION
, and DATABASE_URL_DEPLOY_PREVIEW
respectively.
Add a [[plugins]]
entry to your netlify.toml
file:
[[plugins]]
package = 'netlify-plugin-env'
[plugins.inputs]
mode = 'prefix'
name | description | default |
---|---|---|
mode | The way to append the context or branch name (prefix or suffix ) | prefix |
Update your build command to "source" the .env
file that gets created for you. Note: your .env
should always be in .gitignore
! This script writes a temporary .env file for you at build time, so updated values can be used during the build process.
You can do this in netlify.toml
:
[build]
command = ". ./.env && yarn build"
Or through the Netlify UI if you don't have a build
section defined in netlify.toml
:
FAQs
A Netlify plugin to override ENV vars based on a branch or context
The npm package netlify-plugin-contextual-env receives a total of 1,140 weekly downloads. As such, netlify-plugin-contextual-env popularity was classified as popular.
We found that netlify-plugin-contextual-env demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.