Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[now-cli] Add now env command #3999

Merged
merged 51 commits into from
Apr 7, 2020
Merged

[now-cli] Add now env command #3999

merged 51 commits into from
Apr 7, 2020

Conversation

styfle
Copy link
Member

@styfle styfle commented Apr 3, 2020

This PR adds a new command now env for managing environment variables for a given project. This will complement the changes in the Dashboard and will provide 3 possible environments: production, preview, and development.

  • Add now env ls
  • Add now env add
  • Add now env rm
  • Add now env pull
  • Add test for now env ls
  • Add test for now env add
  • Add test for now env rm -y
  • Add test for now env pull -y
  • Add test for now env add FOO preview < secret.txt
  • Add test deployment to verify env var is assigned to both build and runtime
  • Test on Windows
  ▲ now env [options] <command>

  Commands:

    ls      [environment]              List all variables for the specified environment
    add     [name] [environment]       Add an environment variable (see examples below)
    rm      [name] [environment]       Remove an environment variable (see examples below)
    pull    [filename]                 Read development environment from the cloud and write to a file [.env]

  Options:

    -h, --help                     Output usage information
    -A FILE, --local-config=FILE   Path to the local `now.json` file
    -Q DIR, --global-config=DIR    Path to the global `.now` directory
    -d, --debug                    Debug mode [off]
    -t TOKEN, --token=TOKEN        Login token

  Examples:

  – Add a new variable to multiple environments

      $ now env add <name>
      $ now env add API_TOKEN

  – Add a new variable for a specific environment

      $ now env add <name> <production | preview | development>
      $ now env add DB_CONNECTION production

  – Add a new environment variable from stdin

      $ cat <file> | now env add <name> <production | preview | development>
      $ cat ~/.npmrc | now env add NPM_RC preview
      $ now env add DB_PASS production < secret.txt

  – Remove a variable from multiple environments

      $ now env rm <name>
      $ now env rm API_TOKEN

  – Remove a variable from a specific environment

      $ now env rm <name> <production | preview | development>
      $ now env rm NPM_RC preview

@codecov
Copy link

codecov bot commented Apr 3, 2020

Codecov Report

Merging #3999 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3999   +/-   ##
=======================================
  Coverage   13.13%   13.13%           
=======================================
  Files         290      290           
  Lines       10312    10312           
  Branches     1348     1348           
=======================================
  Hits         1354     1354           
  Misses       8865     8865           
  Partials       93       93           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7298d02...7298d02. Read the comment docs.

@vercel vercel bot requested a deployment to Preview April 7, 2020 16:38 Abandoned
@vercel vercel bot requested a deployment to Preview April 7, 2020 16:38 Abandoned
Copy link
Member

@lucleray lucleray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Co-Authored-By: Luc <luc.leray@gmail.com>
@kodiakhq kodiakhq bot merged commit 1a13399 into master Apr 7, 2020
@kodiakhq kodiakhq bot deleted the PRODUCT-2176/now-env-cli branch April 7, 2020 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants