diff --git a/apphub/src/config/config.ini b/apphub/src/config/config.ini index 8af60e00..221684e6 100755 --- a/apphub/src/config/config.ini +++ b/apphub/src/config/config.ini @@ -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 diff --git a/docker/apphub/Dockerfile b/docker/apphub/Dockerfile index bc70cb8f..7df27274 100644 --- a/docker/apphub/Dockerfile +++ b/docker/apphub/Dockerfile @@ -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"] \ No newline at end of file diff --git a/docker/apphub/config/entrypoint.sh b/docker/apphub/config/entrypoint.sh index 536d9486..7a31368f 100644 --- a/docker/apphub/config/entrypoint.sh +++ b/docker/apphub/config/entrypoint.sh @@ -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 diff --git a/systemd/websoft9.service b/systemd/websoft9.service index f996a262..fb1e1dbc 100644 --- a/systemd/websoft9.service +++ b/systemd/websoft9.service @@ -1,6 +1,6 @@ [Unit] Description=Websoft9 Linux AppStore -Requires=network.target docker +Requires=network.target docker.service After=network.target docker.service [Service] diff --git a/version.json b/version.json index 404793ae..3d7e72aa 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "version": "0.8.26", + "version": "0.8.26-rc34", "plugins": { "portainer": "0.0.6", "nginx": "0.0.5",