#!/bin/sh /etc/rc.common

USE_PROCD=1
START=99

NAME="hiddify"
PROG="/usr/bin/hiddify-cli"
 
 
start_service() {
	config_load "$NAME"

	local enabled config appconfig
	config_get_bool enabled "main" "enabled" "0"
	[ "$enabled" -eq "1" ] || return 0
	
	config_get config "main" "config"
	config_get appconfig "main" "appconfig" 
	args=""
	args="$args run -c $config -d $appconfig"
	procd_open_instance
	procd_set_param command $PROG $args
#	procd_set_param stdout 1
#	procd_set_param stderr 1
	procd_set_param respawn
	procd_close_instance
}
