Code Monkey home page Code Monkey logo

envp's Introduction

ENVP

GitHub release (latest SemVer) GitHub all releases test release CodeQL Go Report Card codecov

ENVP is a shell wrapper command-line tool for macOS and Linux that enables you to run commands or shells with specific environment variable configurations based on profiles. It also allows you to run scripts to set up these profiles. With ENVP, you can easily switch between different environment configurations, even simultaneously in different terminal windows. This tool provides a convenient way to manage and control your environment variables for various development and testing scenarios.

envp intro

Installation

brew:

brew install sunggun-yu/tap/envp

Quick Start

Config file

Location of config file is ~/.config/envp/config.yaml.

please create folder and config file if it is not created.

mkdir -p ~/.config/envp
vim ~/.config/envp/config.yaml

config file example:

default: ""
profiles:
  my-profile:
    desc: profile description
    env:
      - name: HTTPS_PROXY
        value: http://some-proxy:3128
      - name: MY_PASSWORD
        value: $(cat ~/.config/my-password-file)
    init-script:
      - run: |
          echo "this is init script 1"
      - run: |
          echo "this is init script 2"

Start new shell with profile

You can create new shell session with injected environment variable from your profile.

# start new shell session with specific profile
envp start my-profile

envp's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar sunggun-yu avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

envp's Issues

Alias is not working

alias, such as ll,and tilde ~ for home is not working. considering to use go-sh or something like that

leverage the nested profile structure to inherit the env-vars from parent to children.

let's say I have config like this, and NO_PROXY is repeating in all profile with same value.

profiles:
  gke:
    dev:
      desc: GKE proxy for dev cluster
      env:
      - name: HTTPS_PROXY
        value: http://<ip-addr-dev>:443
      - name: NO_PROXY
        value: localhost,127.0.0.1,.googleapis.com
      - name: KUBECONFIG
        value: /Users/meow/.kube/gke-dev
    qa:
      desc: GKE proxy for qa cluster
      env:
      - name: HTTPS_PROXY
        value: http://<ip-addr-qa>:443
      - name: NO_PROXY
        value: localhost,127.0.0.1,.googleapis.com
      - name: KUBECONFIG
        value: /Users/meow/.kube/gke-qa
    test:
      desc: GKE proxy for test cluster
      env:
      - name: HTTPS_PROXY
        value: http://<ip-addr-test>:443
      - name: NO_PROXY
        value: localhost,127.0.0.1,.googleapis.com
      - name: KUBECONFIG
        value: /Users/meow/.kube/gke-test

since parent profile can have desc and env, set common and repeating env in parent and inherits to the children would be nice.

profiles:
  gke:
    desc: GKE proxy group
    env:
    - name: NO_PROXY
      value: localhost,127.0.0.1,.googleapis.com
    dev:
      desc: GKE proxy for dev cluster
      env:
      - name: HTTPS_PROXY
        value: http://<ip-addr-dev>:443
      - name: KUBECONFIG
        value: /Users/meow/.kube/gke-dev
    qa:
      desc: GKE proxy for qa cluster
      env:
      - name: HTTPS_PROXY
        value: http://<ip-addr-qa>:443
      - name: KUBECONFIG
        value: /Users/meow/.kube/gke-qa
    test:
      desc: GKE proxy for test cluster
      env:
      - name: HTTPS_PROXY
        value: http://<ip-addr-test>:443
      - name: KUBECONFIG
        value: /Users/meow/.kube/gke-test

Start command

Start new sh session

doing envp -- kubectl every time might be annoying.
I can do envp -- zsh to create new session. so, provide the short-cut with start command

# start new sh with default profile
envp start
# start new sh for specific profile
envp start profile-name

just run $SHELL

user should be able to set default shell
maybe refactoring the config file

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.