Skip to content

Commit

Permalink
修复环境变量含有双引号时会异常的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mokeyjay committed Nov 27, 2023
1 parent dec3ee9 commit 689527e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ file=".env"
for var in "${env[@]}"
do
# 部分环境变量值含有空格、换行,得用双引号包起来,不然 source 时会报错
echo "$var=\"${!var}\"" >> $file
value="${!var}"
value="${value//\"/\\\"}"
echo "$var=\"$value\"" >> $file
done

chown -R www-data:www-data /var/www/html
Expand Down

0 comments on commit 689527e

Please sign in to comment.