From 971929ac290441789ee15c5f511125fe755df8d7 Mon Sep 17 00:00:00 2001 From: Joseph Le Date: Fri, 13 Oct 2023 18:20:43 +1100 Subject: [PATCH] update env source --- README.md | 4 +--- install.sh | 7 +++++++ service/giteaService.sh | 8 +++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ba94298..1120f0d 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,11 @@ Copy environment file ### 5) Fill in environment variables (\*) -- Git username: -
getUsername
- root@root# ```sh nano service_run/giteaService.conf ``` + ### 6) Add Nginx configuration - Open the Nginx configuration file. diff --git a/install.sh b/install.sh index 1e4ff1e..754b4c5 100755 --- a/install.sh +++ b/install.sh @@ -17,23 +17,30 @@ if [ -d "/etc/systemd/system" ]; then find $pwd_install/service -type f -not -name "giteaService.conf" -exec cp {} $pwd_install/service_run \; sleep 2 && + sudo sed -i "s#ExecStart=.*#ExecStart=$escaped_pwd_install/service_run/giteaService.sh#" $pwd_install/service_run/giteaHook.service && echo -e "* \e[32mExecStart\e[0m *" && sleep 1 && + sudo sed -i "s#WorkingDirectory=.*#WorkingDirectory=$escaped_pwd_install/service_run#" $pwd_install/service_run/giteaHook.service && echo -e "* \e[32mWorkingDirectory\e[0m *" && sleep 1 && + sudo sed -i "s#EnvironmentFile=.*#EnvironmentFile=$escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaHook.service && echo -e "* \e[32mEnvironmentFile\e[0m *" && sleep 1 && + sudo sed -i "s#HOOK_PATH=.*#HOOK_PATH=$escaped_pwd_install#" $pwd_install/service_run/giteaService.conf && echo -e "* \e[32mHOOK_PATH\e[0m *" && sleep 1 && + sudo sed -i "s#source .*#source $escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaHook.sh && echo -e "* \e[32mEXEC_FILE\e[0m *" && echo "" sleep 1 && + sudo sed -i "s#source .*#source $escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaService.sh && + systemctl stop giteaHook.service input_file="$pwd_install/service_run/giteaService.conf" && diff --git a/service/giteaService.sh b/service/giteaService.sh index 6f17bbd..f0ae540 100755 --- a/service/giteaService.sh +++ b/service/giteaService.sh @@ -1,10 +1,12 @@ #!/bin/bash - +source /home/phuc/gitea_CICD/service_run/giteaService.conf # Đường dẫn tới tệp index.js indexjs_path=$HOOK_PATH/index.js project_path=$HOOK_PATH -USERNAME=$(echo "$GIT_USERNAME" | sed 's/@/%40/g') -PASSWORD=$(echo "$GIT_PASSWORD" | sed 's/@/%40/g') + +USERNAME=$(echo "$GIT_USERNAME" | sed 's/@/%40/g') +PASSWORD=$(echo "$GIT_PASSWORD" | sed 's/@/%40/g') + REPOSITORY_AUTH="https://$USERNAME:$PASSWORD@$(echo $GIT_REPOSITORY | sed 's#https://##')" cd "$PROJECT_PATH" &&