Skip to content

Commit 87b006b

Browse files
author
Alexandros Ioannides
authored
Update v-add-fastcgi-cache
1 parent dfdb3fc commit 87b006b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

bin/v-add-fastcgi-cache

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/bash
22
# info: Add FastCGI nginx support
3-
# options: USER DOMAIN [LENTGH] [DEBUG] [RESTART]
3+
# options: USER DOMAIN [DURATION] [DEBUG] [RESTART]
44
# labels: hestia web
55
#
66
# example: v-add-fastcgi-cache user domain.tld 30m
77
#
88
# The function enables FastCGI cache for nginx
9-
# For Length only use time in seconds (10s) minutes (10m) or days (10d)
9+
# Acceptable values for duration is time in seconds (10s) minutes (10m) or days (10d)
1010
# Add "yes" as last parameter to append debug information to response headers
1111

1212
#----------------------------------------------------------#
@@ -16,7 +16,7 @@
1616
# Argument definition
1717
user=$1
1818
domain=$2
19-
length=${3-30m}
19+
duration=${3-30m}
2020
debug=${4-no}
2121
restart=${5-no}
2222

@@ -36,8 +36,8 @@ is_object_unsuspended 'user' 'USER' "$user"
3636
is_object_valid 'web' 'DOMAIN' "$domain"
3737
is_object_unsuspended 'web' 'DOMAIN' "$domain"
3838

39-
if ! [[ "$length" =~ ^[0-9].*[s|m|d]$ ]]; then
40-
echo "Invalid length";
39+
if ! [[ "$duration" =~ ^[0-9].*[s|m|d]$ ]]; then
40+
echo "Invalid duration";
4141
exit 2;
4242
fi
4343
# Perform verification if read-only mode is enabled
@@ -51,7 +51,7 @@ check_hestia_demo_mode
5151
# Load domain data
5252
parse_object_kv_list $(grep "DOMAIN='$domain'" $USER_DATA/web.conf)
5353

54-
# Check if nginx is not in proxy mode
54+
# Check that nginx is not in proxy mode
5555
if [ "$WEB_SYSTEM" != 'nginx' ]; then
5656
echo "Error: nginx is in proxy mode"
5757
exit $E_NOTEXIST
@@ -103,13 +103,13 @@ mkdir -p /var/cache/nginx/micro/$domain
103103
if [ -z "$FASTCGI_CACHE" ]; then
104104
add_object_key "web" 'DOMAIN' "$domain" 'FASTCGI_CACHE' 'ALIAS'
105105
fi
106-
if [ -z "$FASTCGI_LENGTH" ]; then
107-
add_object_key "web" 'DOMAIN' "$domain" 'FASTCGI_LENGTH' 'ALIAS'
106+
if [ -z "$FASTCGI_DURATION" ]; then
107+
add_object_key "web" 'DOMAIN' "$domain" 'FASTCGI_DURATION' 'ALIAS'
108108
fi
109109

110110
# Set FastCGI cache flag to enabled
111111
update_object_value 'web' 'DOMAIN' "$domain" '$FASTCGI_CACHE' 'yes'
112-
update_object_value 'web' 'DOMAIN' "$domain" 'FASTCGI_LENGTH' "$length"
112+
update_object_value 'web' 'DOMAIN' "$domain" 'FASTCGI_DURATION' "$duration"
113113

114114
if [ "$restart" = "yes" ]; then
115115
# Restart web server

0 commit comments

Comments
 (0)