feat: check if dokkurc files are readable before attempting to source
If the files are unreadable, exit immediately so developers take notice. Closes #3033
This commit is contained in:
20
dokku
20
dokku
@@ -3,8 +3,24 @@ set -eo pipefail
|
|||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
export DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
|
export DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
|
||||||
[[ -f $DOKKU_ROOT/dokkurc ]] && source "$DOKKU_ROOT/dokkurc"
|
if [[ -f "$DOKKU_ROOT/dokkurc" ]]; then
|
||||||
[[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source "$f"; done
|
if [[ -r $DOKKU_ROOT/dokkurc ]]; then
|
||||||
|
source "$DOKKU_ROOT/dokkurc"
|
||||||
|
else
|
||||||
|
echo "Unable to read $DOKKU_ROOT/dokkurc for sourcing" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ -d $DOKKU_ROOT/.dokkurc ]]; then
|
||||||
|
for f in $DOKKU_ROOT/.dokkurc/*; do
|
||||||
|
if [[ -r "$f" ]]; then
|
||||||
|
source "$f"
|
||||||
|
else
|
||||||
|
echo "Unable to read $f for sourcing" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
export DOKKU_DISTRO
|
export DOKKU_DISTRO
|
||||||
|
|||||||
Reference in New Issue
Block a user