Only export dotenv file if its exist

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@gmail.com>
This commit is contained in:
Andrei Jiroh Halili 2023-07-15 17:55:57 +00:00
parent c6bcc8722c
commit 4022a2add6

View file

@ -7,7 +7,9 @@ fi
## source vars from .env first ##
_root_directory_git=$(git rev-parse --show-toplevel)
# shellcheck file=/dev/null
source "$_root_directory_git/.env"
if [[ -f "$_root_directory_git/.env" ]]; then
source "$_root_directory_git/.env"
fi
_branch_name_git=$(git rev-parse --abbrev-ref HEAD)
_commit_sha=$(git rev-parse HEAD)