update env source

This commit is contained in:
Joseph Le 2023-10-13 18:20:43 +11:00
parent 2892a9f0b6
commit 971929ac29
3 changed files with 13 additions and 6 deletions

View File

@ -37,13 +37,11 @@ Copy environment file
### 5) Fill in environment variables (\*)
- Git username:
<div><img src="https://i.ibb.co/pLR2BjH/image.png" alt="getUsername" width="300"></div>
root@root#
```sh
nano service_run/giteaService.conf
```
### 6) Add Nginx configuration
- Open the Nginx configuration file.

View File

@ -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" &&

View File

@ -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" &&