This commit is contained in:
qiaofeng1227 2023-10-13 17:33:18 +08:00
parent 7b3a0cc4ae
commit 508cfbbf28
5 changed files with 38 additions and 40 deletions

View file

@ -5,10 +5,12 @@ user_name = help@websoft9.com
user_pwd = E3cMekM72yPp1pUX
nike_name = admin
#The config for gitea
#The config for gitea.
# entrypoint.sh will get the user_name and email default value,it mean these must the gitea default
[gitea]
base_url = http://websoft9-git:3000/api/v1
user_name = websoft9
email = help@websoft9.com
user_pwd = RilXTqVRvEvU
#The config for portainer

View file

@ -48,5 +48,6 @@ RUN rm -rf apphub/docs apphub/tests library.zip plugin-appstore && \
apt clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc /usr/share/doc-base
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -1,44 +1,39 @@
#!/bin/bash
# check credentials exists
check_file_exists() {
file_path=$1
max_attempts=$2
for ((i=1; i<=max_attempts; i++))
do
if [ -f "$file_path" ]; then
echo "$file_path exists"
return 0
else
echo "$file_path is not exists, wait a moment.."
fi
sleep 1
if ((i==max_attempts)); then
echo "$file_path is not exists, app may be work normally."
return 1
fi
done
}
set +e
check_file_exists "/websoft9/credentials/credential_proxy" 1
check_file_exists "/websoft9/credentials/credential_deployment" 1
check_file_exists "/websoft9/credentials/credential_git" 1
# set git user and email
if [ $? -eq 0 ]; then
username=$(jq -r '.username' /websoft9/credentials/credential_git)
email=$(jq -r '.email' /websoft9/credentials/credential_git)
else
echo "Git set with default value"
username="websoft9"
email="help@websoft9.com"
fi
git config --global user.name "$username"
git config --global user.email "$email"
set -e
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
echo $username
echo $email
if [[ -n "$username" ]]; then
git config --global user.name "$username"
else
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
fi
# start by supervisord
/usr/bin/supervisord
supervisorctl start apphub

View file

@ -1,6 +1,6 @@
[Unit]
Description=Websoft9 Linux AppStore
Requires=network.target docker
Requires=network.target docker.service
After=network.target docker.service
[Service]

View file

@ -1,5 +1,5 @@
{
"version": "0.8.26",
"version": "0.8.26-rc34",
"plugins": {
"portainer": "0.0.6",
"nginx": "0.0.5",