Skip to content

Commit

Permalink
🐛 fix: env files not downloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
cy948 committed Jan 4, 2025
1 parent 5f469c0 commit 9d3a635
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions docker-compose/local/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,20 @@ FILES=(
"$SUB_DIR/docker-compose.yml"
"$SUB_DIR/init_data.json"
)
ENV_EXAMPLES=(
"$SUB_DIR/.env.zh-CN.example"
"$SUB_DIR/.env.example"
)

# Download files asynchronously
download_file "$SOURCE_URL/${FILES[0]}" "docker-compose.yml"
download_file "$SOURCE_URL/${FILES[1]}" "init_data.json"

# Download .env.example with the specified language
if [ "$LANGUAGE" = "zh_CN" ]; then
download_file "$SOURCE_URL/.env.zh-CN.example" ".env"
download_file "$SOURCE_URL/${ENV_EXAMPLES[0]}" ".env"
else
download_file "$SOURCE_URL/.env.example" ".env"
download_file "$SOURCE_URL/${ENV_EXAMPLES[1]}" ".env"
fi

# ==========================
Expand Down Expand Up @@ -290,6 +294,7 @@ CASDOOR_USER="admin"
CASDOOR_PASSWORD=$(generate_key 6)
if [ $? -ne 0 ]; then
echo $(show_message "security_secrect_regenerate_failed") "CASDOOR_PASSWORD"
CASDOOR_PASSWORD="123"
else
# replace `password` in init_data.json
sed -i "s/"123"/${CASDOOR_PASSWORD}/" init_data.json
Expand All @@ -301,13 +306,14 @@ fi
# Generate Minio S3 User Password
MINIO_ROOT_PASSWORD=$(generate_key 8)
if [ $? -ne 0 ]; then
echo $(show_message "security_secrect_regenerate_failed") "MINIO_ROOT_PASSWORD"
echo $(show_message "security_secrect_regenerate_failed") "MINIO_ROOT_PASSWORD"
MINIO_ROOT_PASSWORD="YOUR_MINIO_PASSWORD"
else
# Search and replace the value of S3_SECRET_ACCESS_KEY in .env
sed -i "s#^MINIO_ROOT_PASSWORD=.*#MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}#" .env
if [ $? -ne 0 ]; then
echo $(show_message "security_secrect_regenerate_failed") "MINIO_ROOT_PASSWORD in \`.env\`"
fi
# Search and replace the value of S3_SECRET_ACCESS_KEY in .env
sed -i "s#^MINIO_ROOT_PASSWORD=.*#MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}#" .env
if [ $? -ne 0 ]; then
echo $(show_message "security_secrect_regenerate_failed") "MINIO_ROOT_PASSWORD in \`.env\`"
fi
fi

# Modify the .env file if the host is specified
Expand Down

0 comments on commit 9d3a635

Please sign in to comment.