Code Monkey home page Code Monkey logo

chenv's Introduction

      _
  ___| |__   ___ _ ____   __
 / __| '_ \ / _ | '_ \ \ / /
| (__| | | |  __| | | \ V /
 \___|_| |_|\___|_| |_|\_/ . modern local environment management

Project Status PyPI Python Version License

Read the documentation at https://chenv.readthedocs.io/ Tests Codecov

pre-commit Black

This command-line interface creates and manages local .env files from various sources.

Coupled with python-dotenv for python, or dotenv for node.js development, it provides better, more consistent environment variable management and developement.

Installation

To install chenv, run this command in your terminal:

$ pip install --user chenv

Also make sure that your $PATH includes $HOME/.local/bin. If not, add this line to your .bashrc / .zshrc:

export PATH=$HOME/.local/bin:$PATH;

Usage

chenv's usage looks like:

$ chenv COMMAND [ARGS]

Commands currently include:

blank

Choose to set .env as a new, blank, .env.blank file.

heroku

Choose to set .env from a remote heroku app config-vars, as .env.[app-name].

  • -t <team>, --team <team>
     

    Pre-fill team name

  • -a <app>, --app <app>
     

    Pre-fill app name

local

Choose to set .env from a local, pre-exsiting .env.* file.

  • filename
    Pre-fill file-suffix name

Project Configurations

chenv also provides two file types that manipulate the output of new .env.* files being set.

.envignore

Specifies intentionally unwanted environment-variables. Each line in a envignore file specifies a pattern.

When deciding whether to ignore an environment variable, chenv checks it's key against the list of patterns described in this file.

Pattern:.envignore uses the unix filename pattern matching, similar to .gitignore's, and as specified at https://docs.python.org/3/library/fnmatch.html

.envmerge

Sepecifies environment variables to merge / override after any input is chosen. This provides consistency to preffered settings such as the logging-level, or NODE_ENV for local development usage in node.js.

chenv's People

Contributors

jonathan-shemer avatar

Stargazers

Nikolaus Schlemm avatar  avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

chenv's Issues

Heroku module assumes you have personal apps

➜  chenv chenv heroku
chenv. modern local environment management
Traceback (most recent call last):
  File "/Users/danielb/.local/bin/chenv", line 8, in <module>
    sys.exit(main())
  File "/Users/danielb/.local/lib/python3.8/site-packages/chenv/main.py", line 11, in main
    cli.cli()
  File "/Users/danielb/.local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/danielb/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/danielb/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/danielb/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/danielb/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/danielb/.local/lib/python3.8/site-packages/chenv/subcommands/heroku/collector.py", line 72, in heroku
    chosen_app = _choose_app(team, app)
  File "/Users/danielb/.local/lib/python3.8/site-packages/chenv/subcommands/heroku/collector.py", line 58, in _choose_app
    team_apps = _prompt_team_apps(default_team, response.json())
  File "/Users/danielb/.local/lib/python3.8/site-packages/chenv/subcommands/heroku/collector.py", line 31, in _prompt_team_apps
    normalized_apps_by_team = dissoc(assoc(apps_by_team, "personal", apps_by_team[None]), None)
KeyError: None

Feat: ephemeral env configuration

Allow setting environment variables from a remote source without writing them to a file, so as not to save sensitive information such as passwords and private keys in plaintext locally.
For example:

  1. Get environment variables from Heroku
  2. Inject the environment variables to the current session (using export?)

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.