Skip to content

Instantly share code, notes, and snippets.

@doughsay
Last active September 20, 2016 23:20
Show Gist options
  • Save doughsay/3f12cad73984255bf5a5e3ce9f00105a to your computer and use it in GitHub Desktop.
Save doughsay/3f12cad73984255bf5a5e3ce9f00105a to your computer and use it in GitHub Desktop.
Dotenv bash helpers
#!/bin/bash
export DOTENV_ENV=${DOTENV_ENV:-dev}
GIT_DIR=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
DOTENV_FILE=$GIT_DIR/.env.$DOTENV_ENV
if [ -e $DOTENV_FILE ]; then source $DOTENV_FILE; fi
$@
#!/bin/bash
DOTENV_ENV=dev dotenv "$@"
#!/bin/bash
DOTENV_ENV=test dotenv "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment