Browse Source

v2raya: init: convert arguments into env variables

Suggested by upstream, to provide forward compatibility.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
lilik-openwrt-22.03
Tianling Shen 3 years ago
committed by Rosen Penev
parent
commit
8465053a58
1 changed files with 17 additions and 17 deletions
  1. +17
    -17
      net/v2raya/files/v2raya.init

+ 17
- 17
net/v2raya/files/v2raya.init View File

@ -17,18 +17,18 @@ is_enabled() {
fi
}
append_param() {
procd_append_param command "$1" $2
append_env() {
procd_append_param env "V2RAYA_$(echo "$1" | tr "[a-z]" "[A-Z]")"="$2"
}
append_param_arg() {
append_env_arg() {
local value
config_get value "$1" "$2" $3
[ -n "$value" ] && append_param "--${2//_/-}" "$value"
[ -n "$value" ] && append_env "$2" "$value"
}
append_param_bool() {
is_enabled "$1" "$2" && append_param "--${2//_/-}"
append_env_bool() {
is_enabled "$1" "$2" && append_env "$2" "true"
}
start_service() {
@ -39,17 +39,17 @@ start_service() {
procd_open_instance "$CONF"
procd_set_param command "$PROG"
append_param_arg "config" "address" "0.0.0.0:2017"
append_param_arg "config" "config" "/etc/v2raya"
append_param_arg "config" "ipv6_support" "auto"
append_param_arg "config" "log_level" "info"
append_param_arg "config" "log_file" "/tmp/v2raya.log"
append_param_arg "config" "log_max_days" "3"
append_param_arg "config" "v2ray_bin"
append_param_arg "config" "v2ray_confdir"
append_param_arg "config" "vless_grpc_inbound_cert_key"
append_param_bool "config" "log_disable_color"
append_param_bool "config" "log_disable_timestamp"
append_env_arg "config" "address" "0.0.0.0:2017"
append_env_arg "config" "config" "/etc/v2raya"
append_env_arg "config" "ipv6_support" "auto"
append_env_arg "config" "log_level" "info"
append_env_arg "config" "log_file" "/tmp/v2raya.log"
append_env_arg "config" "log_max_days" "3"
append_env_arg "config" "v2ray_bin"
append_env_arg "config" "v2ray_confdir"
append_env_arg "config" "vless_grpc_inbound_cert_key"
append_env_bool "config" "log_disable_color"
append_env_bool "config" "log_disable_timestamp"
procd_set_param limits core="unlimited"
procd_set_param respawn


Loading…
Cancel
Save