mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-22 07:30:24 +00:00
apphub
This commit is contained in:
parent
4a76158410
commit
7b3a0cc4ae
1 changed files with 39 additions and 0 deletions
|
@ -1,5 +1,44 @@
|
|||
#!/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
|
||||
|
||||
# start by supervisord
|
||||
/usr/bin/supervisord
|
||||
supervisorctl start apphub
|
||||
|
|
Loading…
Reference in a new issue