Update for encoding git repo password and username

This commit is contained in:
Tianyong Qiu 2025-03-03 10:32:12 +08:00
parent e1370f96b1
commit 17f806e660

View File

@ -456,6 +456,12 @@ declare -g local_components_ports_keys=("devsvc" "notification" "content" "centr
local_components_ports_values=("8007" "8003" "8013" "8005" "8012" "8004") local_components_ports_values=("8007" "8003" "8013" "8005" "8012" "8004")
# used for repository username and password encoding
url_encode() {
echo "$1" | sed 's/@/%40/g'
}
# Get the port number for a local component # Get the port number for a local component
get_port() { get_port() {
local comp="$1" local comp="$1"
@ -713,6 +719,11 @@ devbox_init_command() {
exit 1 exit 1
fi fi
sudo usermod -aG docker $USER
sudo apt-get update -y
sudo apt-get install docker-compose -y
fi fi
# 3.2 Check disk space # 3.2 Check disk space
@ -827,9 +838,11 @@ devbox_init_command() {
exit 1 exit 1
fi fi
ENCODEING_FREELEAPS_USERNAME=$(url_encode "$FREELEAPS_USERNAME")
ENCODEING_FREELEAPS_PASSWORD=$(url_encode "$FREELEAPS_PASSWORD")
# Test if the user can access the freeleaps.com repository # Test if the user can access the freeleaps.com repository
echo "==> Testing access to freeleaps.com repository..." echo "==> Testing access to freeleaps.com repository..."
if ! git ls-remote "https://$FREELEAPS_USERNAME:$FREELEAPS_PASSWORD@freeleaps.com:3443/products/freeleaps.git" &>/dev/null; then if ! git ls-remote "https://$ENCODEING_FREELEAPS_USERNAME:$ENCODEING_FREELEAPS_PASSWORD@freeleaps.com:3443/products/freeleaps.git" &>/dev/null; then
echo "ERROR: Failed to access freeleaps.com repository. Please check your username and password." echo "ERROR: Failed to access freeleaps.com repository. Please check your username and password."
echo "==> [INIT] DevBox environment initialization completed successfully, but access to the freeleaps.com repository failed." echo "==> [INIT] DevBox environment initialization completed successfully, but access to the freeleaps.com repository failed."
exit 1 exit 1
@ -838,7 +851,7 @@ devbox_init_command() {
DOVBOX_CLI_DIR=$(pwd) DOVBOX_CLI_DIR=$(pwd)
FREELEAPS_DIR="$WORKING_HOME/freeleaps" FREELEAPS_DIR="$WORKING_HOME/freeleaps"
FRONTEND_GIT_URL="https://$FREELEAPS_USERNAME:$FREELEAPS_PASSWORD@freeleaps.com:3443/products/freeleaps.git" FRONTEND_GIT_URL="https://$ENCODEING_FREELEAPS_USERNAME:$ENCODEING_FREELEAPS_PASSWORD@freeleaps.com:3443/products/freeleaps.git"
# Check if freeleaps2-frontend exists, if not git clone it # Check if freeleaps2-frontend exists, if not git clone it
if [ ! -d "$FREELEAPS_DIR" ]; then if [ ! -d "$FREELEAPS_DIR" ]; then
pushd "$WORKING_HOME" > /dev/null pushd "$WORKING_HOME" > /dev/null