18 September 2014

Load .secrets from .bashrc

Your shell resource file is a great place to set local environment variables for use in development (things like API keys, etc.) – that is, until you decide to check it into source control.

Solution: Toss those variable assignments into a file called .secrets and use the shell command source to pull them into your environment when the resource file gets loaded.

.secrets

export AWS_ACCESS_KEY_ID=imnottellingimnottelling
export AWS_SECRET_ACCESS_KEY=myfavoritefoodissushi

.bashrc

source ~/.secrets

And now you can safely push your .bashrc up to Github.