stevearc / pypicloud-docker

Docker image for pypicloud
MIT License
86 stars 34 forks source link

configuration corrupted by env script #23

Open martyzz1 opened 5 years ago

martyzz1 commented 5 years ago

As part of a heroku implementation I removed the database backend and used hard coded configuration values for users and groups. And after this I started getting configParser errors...

The reason was whitespace at the start of the line was being stripped, and so indentations were being removed... The trick is to set

IFS=''

Here's my version of your env script scripts/envsubst.sh

#!/bin/bash
IFS=''
while read -r line ; do
    while [[ "$line" =~ (\$\{[ a-zA-Z_][a-zA-Z_0-9]*(:[-=].*)?\}) ]] ; do
        LHS=${BASH_REMATCH[1]}
        RHS="$(eval echo "\"$LHS\"")"
        # if [ -z "$RHS" ]; then
        #     echo Substituting "$LHS" with default value
        # else
        #     echo Substituting "$LHS" from env
        # fi
        line=${line//$LHS/$RHS}
    done
    echo "$line"
done
stevearc commented 5 years ago

I'm not entirely sure what this is used for or how it is supposed to be used. Could you clarify the problem?