Skip to content

Instantly share code, notes, and snippets.

@weavenet
Last active August 5, 2017 13:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weavenet/1c06dab9bbba0437a43f to your computer and use it in GitHub Desktop.
Save weavenet/1c06dab9bbba0437a43f to your computer and use it in GitHub Desktop.
Storing sensitive environment variables

I keep my dot files public, I of course don't want to have my credentials stored in those dotfiles.

To call applications which require credentials to be set as env vars I have the following setup.

Create a file called ~/.run_with_creds with all the secret credentials after an env statement which then calls the input parameters:

env TRELLO_DEVELOPER_PUBLIC_KEY=xxx \
    TRELLO_MEMBER_TOKEN=yyy \
    AWS_ACCESS_KEY_ID=987 \
    AWS_SECRET_ACCESS_KEY=123 \
    $@

For commands that require those credentials, I alias the command to first source that file before running the command.

alias trello=‘. ~/.run_with_creds trello’

.run_with_creds will then execute the command with the credentials set and pass any additional arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment