Code Monkey home page Code Monkey logo

envcrypt's Introduction

envcrypt

envcrypt runs commands in a special process environment loaded from encrypted files.

$ envcrypt -h
usage: envcrypt PATH COMMAND [ARGS...]

Set environment variables defined in encrypted file PATH and run COMMAND.

Arguments:
  PATH     path to a gpg-encrypted file that can be read with eg `gpg -d PATH`
  COMMAND  command to be invoked in the context of the environment defined in PATH

The contents of PATH should be zero or more lines of string keys and values, separated by = and encrypted with GPG:

$ echo AWS_ACCESS_KEY_ID=XXXXXXX | gpg -a -e -o aws.asc
$ envcrypt aws.asc /bin/sh -c 'echo $AWS_ACCESS_KEY_ID'
XXXXXXXX

Prerequisites

envcrypt runs gpg in batch mode, so you must be running gpg-agent for your private key to be accessible.

OSX

Make sure your gpg and gpg-agent executables are version 2 or greater:

$ gpg --version | head -1
gpg (GnuPG/MacGPG2) 2.0.28
$ gpg-agent --version | head -1
gpg-agent (GnuPG) 2.0.29

If you don't have GPG version 2, install GPG Tools. GPG Tools installs into the /usr/local/MacGPG2/bin directory, so add that to your shell's $PATH variable. Then, make sure you have a gpg-agent running in daemon mode:

$ gpg-agent --daemon

Finally, configure gpg to use the agent:

$ echo use-agent >> ~/.gnupg/gpg.conf

Install

This is the easy way; do this unless you definitely need to build from source. Supported platforms:

$ curl -sL -O https://github.com/whilp/envcrypt/releases/download/v0.3/envcrypt-Darwin-x86_64
$ curl -sL -O https://github.com/whilp/envcrypt/releases/download/v0.3/envcrypt-Darwin-x86_64.sha256
$ shasum -c envcrypt-Darwin-x86_64.sha256
envcrypt-Darwin-x86_64: OK
$ mv envcrypt-Darwin-x86_64 ~/bin/envcrypt
$ chmod a+x ~/bin/envcrypt

Make sure ~/bin is a directory in your $PATH; replace it with another directory if you'd prefer.

Install from source

You can also install directly from source (but you probably just want to install the binary):

go get github.com/whilp/envcrypt

Test

make test

License

BSD; see LICENSE.

envcrypt's People

Contributors

whilp avatar jklukas avatar

Watchers

James Cloos avatar

Forkers

outlook-com

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.