mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
Bug fix: restrict IFS to only the read builtin
This commit is contained in:
parent
62a627c89c
commit
5487310f14
1 changed files with 4 additions and 5 deletions
|
@ -80,19 +80,18 @@ EOF
|
||||||
[ -e '/app/.env' ] && cat /app/.env >> /tmp/.env.example
|
[ -e '/app/.env' ] && cat /app/.env >> /tmp/.env.example
|
||||||
|
|
||||||
quote_if_necessary() {
|
quote_if_necessary() {
|
||||||
if grep -q -E -e '^".*" *$' -e "^'.*' *$" <<<"$1"; then
|
if grep -q -E -e '^".*" *$' -e "^'.*' *$" <<<"$*"; then
|
||||||
# preserve single or double quotes if they are provided
|
# preserve single or double quotes if they are provided
|
||||||
echo "$1";
|
echo "$*";
|
||||||
else
|
else
|
||||||
# otherwise double quote the string after escaping \, $, `
|
# otherwise double quote the string after escaping \, $, `
|
||||||
echo "\"$(sed -e 's/\\/\\\\/g' -e 's/\$/\\\$/g' -e 's/`/\\`/g' <<<"$1")\""
|
echo "\"$(sed -e 's/\\/\\\\/g' -e 's/\$/\\\$/g' -e 's/`/\\`/g' <<<"$*")\""
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Default to the environment variable values set in .env.example
|
# Default to the environment variable values set in .env.example
|
||||||
IFS="="
|
|
||||||
sed -n -r -e 's/^#?([A-Za-z0-9_]+=.*)/\1/p' /tmp/.env.example | \
|
sed -n -r -e 's/^#?([A-Za-z0-9_]+=.*)/\1/p' /tmp/.env.example | \
|
||||||
while read var value ; do
|
while IFS='=' read var value ; do
|
||||||
huginn_var="HUGINN_$var"
|
huginn_var="HUGINN_$var"
|
||||||
val="${!huginn_var:-${!var:-$value}}"
|
val="${!huginn_var:-${!var:-$value}}"
|
||||||
echo "$var=$(quote_if_necessary $val)"
|
echo "$var=$(quote_if_necessary $val)"
|
||||||
|
|
Loading…
Add table
Reference in a new issue