title | description |
---|---|
Netlify CLI env command |
Control environment variables for the current site |
Control environment variables for the current site
Usage
netlify env
Flags
debug
(boolean) - Print debugging informationhttp-proxy
(string) - Proxy server address to route requests through.http-proxy-certificate-filename
(string) - Certificate file to use when connecting using a proxy server
Subcommand | description |
---|---|
env:clone |
Clone environment variables from one site to another |
env:get |
Get resolved value of specified environment variable (includes netlify.toml) |
env:import |
Import and set environment variables from .env file |
env:list |
Lists resolved environment variables for site (includes netlify.toml) |
env:set |
Set value of environment variable |
env:unset |
Unset an environment variable which removes it from the UI |
Examples
netlify env:list
netlify env:get VAR_NAME
netlify env:set VAR_NAME value
netlify env:unset VAR_NAME
netlify env:import fileName
netlify env:clone --to <to-site-id>
Clone environment variables from one site to another
Usage
netlify env:clone
Flags
from
(string) - Site ID (From)debug
(boolean) - Print debugging informationhttp-proxy
(string) - Proxy server address to route requests through.http-proxy-certificate-filename
(string) - Certificate file to use when connecting using a proxy serverto
(string) - Site ID (To)
Examples
netlify env:clone --to <to-site-id>
netlify env:clone --to <to-site-id> --from <from-site-id>
Get resolved value of specified environment variable (includes netlify.toml)
Usage
netlify env:get
Arguments
- name - Environment variable name
Flags
context
(string) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev")debug
(boolean) - Print debugging informationhttp-proxy
(string) - Proxy server address to route requests through.http-proxy-certificate-filename
(string) - Certificate file to use when connecting using a proxy serverscope
(builds | functions | post-processing | runtime | any) - Specify a scope
Examples
netlify env:get MY_VAR # get value for MY_VAR in dev context
netlify env:get MY_VAR --context production
netlify env:get MY_VAR --context branch:staging
netlify env:get MY_VAR --scope functions
Import and set environment variables from .env file
Usage
netlify env:import
Arguments
- fileName - .env file to import
Flags
replace-existing
(boolean) - Replace all existing variables instead of merging them with the current onesdebug
(boolean) - Print debugging informationhttp-proxy
(string) - Proxy server address to route requests through.http-proxy-certificate-filename
(string) - Certificate file to use when connecting using a proxy server
Lists resolved environment variables for site (includes netlify.toml)
Usage
netlify env:list
Flags
context
(string) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev")debug
(boolean) - Print debugging informationhttp-proxy
(string) - Proxy server address to route requests through.http-proxy-certificate-filename
(string) - Certificate file to use when connecting using a proxy serverjson
(boolean) - Output environment variables as JSONplain
(boolean) - Output environment variables as plaintextscope
(builds | functions | post-processing | runtime | any) - Specify a scope
Examples
netlify env:list # list variables with values in the dev context and with any scope
netlify env:list --context production
netlify env:list --context branch:staging
netlify env:list --scope functions
netlify env:list --plain
Set value of environment variable
Usage
netlify env:set
Arguments
- key - Environment variable key
- value - Value to set to
Flags
context
(string) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev") (default: all contexts)debug
(boolean) - Print debugging informationhttp-proxy
(string) - Proxy server address to route requests through.http-proxy-certificate-filename
(string) - Certificate file to use when connecting using a proxy serverscope
(builds | functions | post-processing | runtime) - Specify a scope (default: all scopes)
Examples
netlify env:set VAR_NAME value # set in all contexts and scopes
netlify env:set VAR_NAME value --context production
netlify env:set VAR_NAME value --context production deploy-preview
netlify env:set VAR_NAME value --scope builds
netlify env:set VAR_NAME value --scope builds functions
Unset an environment variable which removes it from the UI
Usage
netlify env:unset
Arguments
- key - Environment variable key
Flags
context
(string) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev") (default: all contexts)debug
(boolean) - Print debugging informationhttp-proxy
(string) - Proxy server address to route requests through.http-proxy-certificate-filename
(string) - Certificate file to use when connecting using a proxy server
Examples
netlify env:unset VAR_NAME # unset in all contexts
netlify env:unset VAR_NAME --context production
netlify env:unset VAR_NAME --context production deploy-preview