Replace the command env:import with env:push
Which problem is this feature request solving?
I think env:import is terribly confusing and very prone to errors, and I understand this might be too much to ask, however I think this command reads as import the environment variables to a .env local file, but after it's run the variables are overwritten in the Netlify UI without any warning.
Describe the solution you'd like
Instead of netlify env:import .env:
-
netlify env:getandnetlify env:listto get the environment files -
netlify env:push .envto 'push' the environment variables to netlify
+1. When I read netlify env:import I think I'm importing the env variables from the Netlify UI to my local machine.
If possible, can we also have a command called netlify env:pull .env which pulls the environment variables from the Netlify UI to your local machine?
@ivorpad env:import goes against my expectations as well, and I like that introducing a new word, env:push avoids the confusion that would result from changing it to env:export. 😵
I think it makes sense to add env:push and make it the default, documented command for uploading env vars, but still keep env:import as a legacy alias for backward compatibility.
On a separate note, your point about overriding variables in the UI without warning is now solved with the introduction of a new --replaceExisting flag. When run without the flag, env:import now merges with UI variables instead of replacing them.
@watadarkstar for the "pull"-style functionality you're asking for, we have a proposal in https://github.com/netlify/cli/issues/3262 to add a --plain flag to env:list that formats the env var list so that it can be piped into a local .env file in the proper format. I could potentially see adding an env:pull [path] alias that essentially runs env:list --plain > [path].
@watadarkstar You should be able to use the newly added --plain flag like netlify env:list --plain > [path of file to write] to pull the environment variables & write them to a file on local machine now.
Update the Netlify CLI package to v12.5.0 or greater to use the --plain flag.
Thank you, @tinfoil-knight !