Skip to content

Instantly share code, notes, and snippets.

@esfourteen-zz
Created August 9, 2017 13:01
Show Gist options
  • Save esfourteen-zz/e9127f8b8d73a72d9f608a69dbe0d5e6 to your computer and use it in GitHub Desktop.
Save esfourteen-zz/e9127f8b8d73a72d9f608a69dbe0d5e6 to your computer and use it in GitHub Desktop.
if DATABASE_URL is empty set via .env file if present
#!/bin/bash
[ -z "$DATABASE_URL" ] && [ -f .env ] && source .env
echo "DATABASE_URL=$DATABASE_URL"
@arnoldcano
Copy link

This won't work if say you wanted to migrate your test db locally. This is why originally I had these vars separated out before.

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