netlify-plugin-replace-env

1.0.1 • Public • Published

netlify-plugin-replace-env

This plugin replaces ENV vars interpolations inside other ENV vars.

So if you have an ENV var like MY_VAR=$MY_OTHER_VAR/foo, this plugin is going to replace the value of MY_VAR by substituing MY_OTHER_VAR value.

MY_OTHER_VAR=bar
MY_VAR=$MY_OTHER_VAR/foo
# After the plugin execution
MY_OTHER_VAR=bar
MY_VAR=bar/foo

Enabling the plugin

This plugin is disabled by default for all Netlify deploy contexts.

To enbable it for all deploy contexts, set the env var ENABLE_NETLIFY_PLUGIN_DYNAMIC_REPLACE_ENV to true (must be that value).

To enbalbe for a scpecific deploy context, suffix the above env with the uppercase context name:

  • ENABLE_NETLIFY_PLUGIN_DYNAMIC_REPLACE_ENV_PRODUCTION=true enable for production only deploy context.
  • ENABLE_NETLIFY_PLUGIN_DYNAMIC_REPLACE_ENV_DEPLOY_PREVIEW=true enable for deploy-preview only deploy context.
  • ENABLE_NETLIFY_PLUGIN_DYNAMIC_REPLACE_ENV_BRANCH_DEPLOY=true enable for branch-deploy only deploy context.

Usage

Add the plugin

Add a [[plugins]] entry to your netlify.toml file:

[[plugins]]
package = 'netlify-plugin-replace-env'

/netlify-plugin-replace-env/

    Package Sidebar

    Install

    npm i netlify-plugin-replace-env

    Weekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    9.16 kB

    Total Files

    7

    Last publish

    Collaborators

    • sdbx