diff --git a/net/v2raya/files/v2raya.init b/net/v2raya/files/v2raya.init index cb8173711..f1374914d 100755 --- a/net/v2raya/files/v2raya.init +++ b/net/v2raya/files/v2raya.init @@ -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