Skip to content

Commit c7913ae

Browse files
dr0ilod
authored andcommitted
Move warning when DATA_DIR is set twice
The warning will only show up when it's necessary. See pelias#93.
1 parent 19e9834 commit c7913ae

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/env.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function env_check(){
2424
# loads environment vars from a stream (such as a file)
2525
# example: env_load_stream < .env
2626
function env_load_stream(){
27+
[[ -n $DATA_DIR ]] && printf "DATA_DIR is already set to '$DATA_DIR' - this may cause the DATA_DIR specified in the .env to be ignored\n"
2728
while IFS='=' read -r key value; do
2829
([ -z $key ] || [ -z $value ]) && printf 'Invalid environment var "%s=%s"\n' $key $value && exit 1
2930
if [ -z ${!key} ]; then
@@ -37,8 +38,6 @@ function env_load_stream(){
3738
# ensure locale is correctly set?
3839
# export LC_ALL=en_US.UTF-8
3940

40-
# warn if DATA_DIR is already set
41-
[[ -n $DATA_DIR ]] && printf "DATA_DIR is already set to '$DATA_DIR' - this may cause the DATA_DIR specified in the .env to be ignored\n"
4241
# load DATA_DIR and other vars from docker-compose .env file
4342
# note: strips comments and empty lines
4443
[ -f .env ] && env_load_stream < <(grep -v '^$\|^\s*$\#' .env)

0 commit comments

Comments
 (0)