Coder Social home page Coder Social logo

dotenv-filter-cli's Introduction

dotenv-filter-cli

This is a very small CLI tool to filter environment variables from process.env.

You can kinda see this as the reverse of dotenv; it processes all your current env variables, allows you to filter on them and outputs it as if it were a dotenv file.

My specific use case is that when I run Zeit Now in a CI tool like Travis, I want to give it only the environment variables that start with BACKEND_, like BACKEND_SECRET. The only alternative I saw is to pass every environment variable with, -e BACKEND_SECRET etc. That is not maintainable when you have 10+ variables.

Install with npm i -g dotenv-filter-cli

Usages

$ dotenv-filter --prefix=BACKEND_
BACKEND_SECRET="xxx"
BACKEND_APP_URL="https://example.com"

Or save to a file directly:

$ dotenv-filter --prefix=BACKEND_ > .env

Or if your naming scheme uses consistent suffixes instead of prefixes:

$ dotenv-filter --suffix=_APP
SECRET_APP="xxx"

Or maybe you want to filter on multiple suffixes:

$ dotenv-filter --suffix=_APP --suffix=MAIL
SECRET_APP="xxx"
FROM_MAIL="[email protected]"

Example usage with Zeit Now (note: this is not specific in any way to Zeit):

$ dotenv-filter --prefix=BACKEND > .env.now
$ now --dotenv .env.now

dotenv-filter-cli's People

Contributors

spacek33z avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.