summaryrefslogtreecommitdiff
path: root/plugins/dotenv/dotenv.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/dotenv/dotenv.plugin.zsh')
-rw-r--r--plugins/dotenv/dotenv.plugin.zsh12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh
index b701b5596..89763d0ee 100644
--- a/plugins/dotenv/dotenv.plugin.zsh
+++ b/plugins/dotenv/dotenv.plugin.zsh
@@ -1,13 +1,13 @@
source_env() {
- if [[ -f .env ]]; then
+ if [[ -f $ZSH_DOTENV_FILE ]]; then
# test .env syntax
- zsh -fn .env || echo 'dotenv: error when sourcing `.env` file' >&2
+ zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
if [[ -o a ]]; then
- source .env
+ source $ZSH_DOTENV_FILE
else
set -a
- source .env
+ source $ZSH_DOTENV_FILE
set +a
fi
fi
@@ -16,4 +16,8 @@ source_env() {
autoload -U add-zsh-hook
add-zsh-hook chpwd source_env
+if [[ -z $ZSH_DOTENV_FILE ]]; then
+ ZSH_DOTENV_FILE=.env
+fi
+
source_env