Ensure BLOCK_DURATION and MAX_IPS exist in CONFIG_ENV correctly
This commit is contained in:
@ -9,10 +9,13 @@ SERVICE_NAME="hysteria-ip-limit.service"
|
|||||||
if [ -f "$CONFIG_ENV" ]; then
|
if [ -f "$CONFIG_ENV" ]; then
|
||||||
source "$CONFIG_ENV"
|
source "$CONFIG_ENV"
|
||||||
BLOCK_DURATION="${BLOCK_DURATION:-60}" # Default to 60 seconds if not set
|
BLOCK_DURATION="${BLOCK_DURATION:-60}" # Default to 60 seconds if not set
|
||||||
MAX_IPS="${MAX_IPS:-1}" # Default to 1 IP if not set
|
MAX_IPS="${MAX_IPS:-1}" # Default to 1 IP if not set
|
||||||
|
|
||||||
|
grep -q "^BLOCK_DURATION=" "$CONFIG_ENV" || echo -e "\nBLOCK_DURATION=$BLOCK_DURATION" >> "$CONFIG_ENV"
|
||||||
|
|
||||||
|
grep -q "^MAX_IPS=" "$CONFIG_ENV" || echo "MAX_IPS=$MAX_IPS" >> "$CONFIG_ENV"
|
||||||
else
|
else
|
||||||
BLOCK_DURATION=240
|
echo -e "BLOCK_DURATION=240\nMAX_IPS=5" > "$CONFIG_ENV"
|
||||||
MAX_IPS=5
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Ensure files exist ---
|
# --- Ensure files exist ---
|
||||||
@ -361,4 +364,4 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user