mirror of
https://github.com/joglomedia/LEMPer.git
synced 2026-04-13 00:18:31 +00:00
enhance dotenv
This commit is contained in:
@@ -14,7 +14,7 @@ LEMPER_USERNAME="lemper"
|
||||
LEMPER_PASSWORD=""
|
||||
|
||||
# Administration email. Don't leave it blank!
|
||||
ADMIN_EMAIL="admin@lemper.sh"
|
||||
ADMIN_EMAIL="support@lemper.sh"
|
||||
|
||||
# Auto install, true for auto installation,
|
||||
# false for manual or guided installation.
|
||||
|
||||
@@ -32,15 +32,11 @@
|
||||
# Work even if somebody does "sh lemper.sh".
|
||||
set -e
|
||||
|
||||
# Try to export global path.
|
||||
if [ -z "${PATH}" ] ; then
|
||||
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
fi
|
||||
|
||||
# Unset existing variables.
|
||||
# shellcheck source=.env
|
||||
# shellcheck disable=SC2046
|
||||
unset $(grep -v '^#' .env | grep -v '^\[' | sed -E 's/(.*)=.*/\1/' | xargs)
|
||||
|
||||
# Get base directory.
|
||||
export BASEDIR && \
|
||||
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )
|
||||
|
||||
@@ -8,11 +8,16 @@
|
||||
|
||||
# Export environment variables.
|
||||
if [ -f ".env" ]; then
|
||||
# Clean environemnt first.
|
||||
# shellcheck source=.env
|
||||
# shellcheck disable=SC2046
|
||||
unset $(grep -v '^#' .env | grep -v '^\[' | sed -E 's/(.*)=.*/\1/' | xargs)
|
||||
|
||||
# shellcheck source=.env
|
||||
# shellcheck disable=SC1094
|
||||
source <(grep -v '^#' .env | grep -v '^\[' | sed -E 's|^(.+)=(.*)$|: ${\1=\2}; export \1|g')
|
||||
else
|
||||
echo "Environment variables required, but not found."
|
||||
echo "Environment variables required, but the Dotenv file not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user