diff options
Diffstat (limited to 'plugins/dotenv')
-rw-r--r-- | plugins/dotenv/README.md | 2 | ||||
-rw-r--r-- | plugins/dotenv/dotenv.plugin.zsh | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/plugins/dotenv/README.md b/plugins/dotenv/README.md index e0e75571f..e880e9d69 100644 --- a/plugins/dotenv/README.md +++ b/plugins/dotenv/README.md @@ -2,7 +2,7 @@ Automatically load your project ENV variables from `.env` file when you `cd` into project root directory. -Storing configuration in the environment is one of the tenets of a [twelve-factor app](http://www.12factor.net). Anything that is likely to change between deployment environments, such as resource handles for databases or credentials for external services, should be extracted from the code into environment variables. +Storing configuration in the environment is one of the tenets of a [twelve-factor app](https://www.12factor.net). Anything that is likely to change between deployment environments, such as resource handles for databases or credentials for external services, should be extracted from the code into environment variables. ## Installation diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh index fa47c4c68..b701b5596 100644 --- a/plugins/dotenv/dotenv.plugin.zsh +++ b/plugins/dotenv/dotenv.plugin.zsh @@ -1,7 +1,8 @@ -#!/bin/zsh - source_env() { if [[ -f .env ]]; then + # test .env syntax + zsh -fn .env || echo 'dotenv: error when sourcing `.env` file' >&2 + if [[ -o a ]]; then source .env else @@ -14,3 +15,5 @@ source_env() { autoload -U add-zsh-hook add-zsh-hook chpwd source_env + +source_env |