Skip to content

Instantly share code, notes, and snippets.

@shawnbot
Created August 7, 2013 01:36
Show Gist options
  • Save shawnbot/6170473 to your computer and use it in GitHub Desktop.
Save shawnbot/6170473 to your computer and use it in GitHub Desktop.
Read environment variables from your .env in make tasks.
test:
source .env && echo "my secret key is: $$SECRET_KEY"
@cybertk
Copy link

cybertk commented Nov 29, 2016

Works like a charm!

@asquel
Copy link

asquel commented Oct 10, 2018

include .env
export

@ken0x0a
Copy link

ken0x0a commented Mar 10, 2019

include .env
export

Works great! Thank you @asquel!!

@donhector
Copy link

include .env
export

This has the downside that if your values contain special Make characters such as # , $, etc... you will need to escape them in your .env file. While this might not be a big deal in some cases, it will be if the same .env file is used by other tools that are not expecting the values to be escaped.

@beemi
Copy link

beemi commented Aug 28, 2020

e

include .env
export

This one works

`include .env
export

local-run:
@echo "Run local run tests with slaves:" ${NUMBER_OF_SLAVES}
./scripts/local-run.sh`

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