Skip to content
This repository has been archived by the owner on May 22, 2019. It is now read-only.

Commit

Permalink
Merge pull request #146 from Financial-Times/env-singleton
Browse files Browse the repository at this point in the history
Only export .env variables once per Make command
  • Loading branch information
Adam Braimbridge authored Feb 2, 2017
2 parents cd3e56e + fd2b0f6 commit a229641
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
# It's maintained on GitHub. Submit pull requests here: https://www.github.com/Financial-Times/n-makefile

# Export environment variables if a .env file is present.
ifeq ($(ENV_EXPORTED),) # ENV vars not yet exported
ifneq ("$(wildcard .env)","")
sinclude .env
export $(shell [ -f .env ] && sed 's/=.*//' .env)
export ENV_EXPORTED=true
$(info Note — An .env file exists. Its contents have been exported as environment variables.)
endif
endif

# Enforce repo ownership
ifeq ("$(wildcard ft.yml)","")
Expand Down

0 comments on commit a229641

Please sign in to comment.