mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2026-01-06 04:59:35 -06:00
fix: add Prisma connection pool variables to update_env_file function
- Added DB_CONNECTION_LIMIT, DB_POOL_TIMEOUT, DB_CONNECT_TIMEOUT, DB_IDLE_TIMEOUT, DB_MAX_LIFETIME - Sets defaults (30, 20, 10, 300, 1800) if not already in .env - Checks for missing variables during update mode - Automatically adds them with comment header - Ensures existing installations get connection pool settings on update
This commit is contained in:
41
setup.sh
41
setup.sh
@@ -2703,6 +2703,13 @@ update_env_file() {
|
||||
: ${TFA_MAX_REMEMBER_SESSIONS:=5}
|
||||
: ${TFA_SUSPICIOUS_ACTIVITY_THRESHOLD:=3}
|
||||
|
||||
# Prisma Connection Pool
|
||||
: ${DB_CONNECTION_LIMIT:=30}
|
||||
: ${DB_POOL_TIMEOUT:=20}
|
||||
: ${DB_CONNECT_TIMEOUT:=10}
|
||||
: ${DB_IDLE_TIMEOUT:=300}
|
||||
: ${DB_MAX_LIFETIME:=1800}
|
||||
|
||||
# Track which variables were added
|
||||
local added_vars=()
|
||||
|
||||
@@ -2764,6 +2771,21 @@ update_env_file() {
|
||||
if ! grep -q "^TFA_SUSPICIOUS_ACTIVITY_THRESHOLD=" "$env_file"; then
|
||||
added_vars+=("TFA_SUSPICIOUS_ACTIVITY_THRESHOLD")
|
||||
fi
|
||||
if ! grep -q "^DB_CONNECTION_LIMIT=" "$env_file"; then
|
||||
added_vars+=("DB_CONNECTION_LIMIT")
|
||||
fi
|
||||
if ! grep -q "^DB_POOL_TIMEOUT=" "$env_file"; then
|
||||
added_vars+=("DB_POOL_TIMEOUT")
|
||||
fi
|
||||
if ! grep -q "^DB_CONNECT_TIMEOUT=" "$env_file"; then
|
||||
added_vars+=("DB_CONNECT_TIMEOUT")
|
||||
fi
|
||||
if ! grep -q "^DB_IDLE_TIMEOUT=" "$env_file"; then
|
||||
added_vars+=("DB_IDLE_TIMEOUT")
|
||||
fi
|
||||
if ! grep -q "^DB_MAX_LIFETIME=" "$env_file"; then
|
||||
added_vars+=("DB_MAX_LIFETIME")
|
||||
fi
|
||||
|
||||
# If there are missing variables, add them
|
||||
if [ ${#added_vars[@]} -gt 0 ]; then
|
||||
@@ -2849,6 +2871,25 @@ EOF
|
||||
echo "TFA_SUSPICIOUS_ACTIVITY_THRESHOLD=$TFA_SUSPICIOUS_ACTIVITY_THRESHOLD" >> "$env_file"
|
||||
fi
|
||||
|
||||
# Add Prisma connection pool config if missing
|
||||
if printf '%s\n' "${added_vars[@]}" | grep -q "DB_CONNECTION_LIMIT"; then
|
||||
echo "" >> "$env_file"
|
||||
echo "# Database Connection Pool Configuration (Prisma)" >> "$env_file"
|
||||
echo "DB_CONNECTION_LIMIT=$DB_CONNECTION_LIMIT" >> "$env_file"
|
||||
fi
|
||||
if printf '%s\n' "${added_vars[@]}" | grep -q "DB_POOL_TIMEOUT"; then
|
||||
echo "DB_POOL_TIMEOUT=$DB_POOL_TIMEOUT" >> "$env_file"
|
||||
fi
|
||||
if printf '%s\n' "${added_vars[@]}" | grep -q "DB_CONNECT_TIMEOUT"; then
|
||||
echo "DB_CONNECT_TIMEOUT=$DB_CONNECT_TIMEOUT" >> "$env_file"
|
||||
fi
|
||||
if printf '%s\n' "${added_vars[@]}" | grep -q "DB_IDLE_TIMEOUT"; then
|
||||
echo "DB_IDLE_TIMEOUT=$DB_IDLE_TIMEOUT" >> "$env_file"
|
||||
fi
|
||||
if printf '%s\n' "${added_vars[@]}" | grep -q "DB_MAX_LIFETIME"; then
|
||||
echo "DB_MAX_LIFETIME=$DB_MAX_LIFETIME" >> "$env_file"
|
||||
fi
|
||||
|
||||
print_status ".env file updated with ${#added_vars[@]} new variable(s)"
|
||||
print_info "Added variables: ${added_vars[*]}"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user