websoft9/docker/apphub/config/entrypoint.sh

40 lines
801 B
Bash
Raw Normal View History

2023-09-18 17:13:15 +08:00
#!/bin/bash
2023-10-13 17:33:18 +08:00
set -e
2023-10-13 16:27:02 +08:00
2023-10-13 17:33:18 +08:00
try_times=3
# set git user and email
for ((i=0; i<$try_times; i++)); do
(
username=$(apphub getconfig --section gitea --key user_name)
email=$(apphub getconfig --section gitea --key email)
) || true
if [ -n "$username" ] && [ -n "$email" ]; then
break
fi
echo "Command failed, retrying..."
sleep 3
done
2023-10-13 16:27:02 +08:00
2023-10-13 17:33:18 +08:00
echo $username
echo $email
2023-10-13 16:27:02 +08:00
2023-10-13 17:33:18 +08:00
if [[ -n "$username" ]]; then
git config --global user.name "$username"
2023-10-13 16:27:02 +08:00
else
2023-10-13 17:33:18 +08:00
echo "username is null"
exit 1
fi
regex="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
if [[ $email =~ $regex ]]; then
git config --global user.email "$email"
else
echo "Not have correct email"
exit 1
2023-10-13 16:27:02 +08:00
fi
2023-09-19 18:53:05 +08:00
# start by supervisord
2023-09-20 11:34:22 +08:00
/usr/bin/supervisord
2023-10-10 16:20:50 +08:00
supervisorctl start apphub
2023-09-19 14:32:20 +08:00
tail -f /dev/null