1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 10:31:51 +00:00

Remove startup delay and rename config of Nginx-ha

This commit is contained in:
Ycarus 2018-06-26 14:41:35 +02:00
parent 5f882b75ae
commit b82d337a68
3 changed files with 7 additions and 25 deletions

View file

@ -6,29 +6,20 @@ else
m = Map("nginx-ha", translate("Nginx High Availability"), "%s - %s" %{translate("Nginx High Availability"), translate("NOT RUNNING")})
end
s = m:section(TypedSection, "general", translate("General Setting"))
s = m:section(TypedSection, "nginxha", translate("Settings"))
s.addremove = true
o = s:option(Flag, "enable", translate("Enable"))
o.rmempty = false
o = s:option(Value, "startup_delay", translate("Startup Delay"))
o:value(0, translate("Not enabled"))
for _, v in ipairs({5, 10, 15, 25, 40}) do
o:value(v, translate("%u seconds") %{v})
end
o.datatype = "uinteger"
o.default = 0
o.rmempty = false
o = s:option(Value, "listen", translate("Listen Address:Port"))
o.placeholder = "0.0.0.0:6666"
o.default = "0.0.0.0:6666"
o.rmempty = false
o = s:option(Value, "timeout", translate("Timeout Connect (ms)"))
o.placeholder = "666"
o.default = "666"
o.placeholder = "1000"
o.default = "1000"
o.datatype = "range(33, 10000)"
o.rmempty = false

View file

@ -1,16 +1,14 @@
config general 'ShadowSocks'
config nginxha 'ShadowSocks'
option enable '0'
option retries '1'
option timeout '1000'
option listen '0.0.0.0:65101'
option startup_delay '5'
list upstreams '1.2.3.4:65101 weight=1 max_fails=3 fail_timeout=30s'
config general 'VPN'
config nginxha 'VPN'
option enable '0'
option retries '1'
option timeout '1000'
option listen '0.0.0.0:65001'
option startup_delay '5'
list upstreams '1.2.3.4:65001 weight=1 max_fails=3 fail_timeout=30s'

View file

@ -20,11 +20,10 @@ _err() {
}
validate_section() {
uci_validate_section nginx-ha general "${1}" \
uci_validate_section nginx-ha nginxha "${1}" \
'enable:bool:0' \
'retries:uinteger:3' \
'timeout:uinteger:4000' \
'startup_delay:uinteger:5' \
'listen:string' \
'upstreams:list(string)'
}
@ -33,12 +32,6 @@ genline_srv(){
echo " server $1;"
}
boot() {
local delay=$(uci -q get $NAME.general.startup_delay)
(sleep ${delay:-0} && start >/dev/null 2>&1) &
return 0
}
start_instance() {
local enable retries timeout startup_delay listen upstreams
@ -69,7 +62,7 @@ start_instance() {
start_service() {
local stream=""
config_load nginx-ha
config_foreach start_instance general
config_foreach start_instance nginxha
[ -z "$stream" ] && return