Using utils.GetNetwork
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
type winsize struct {
|
||||
@@ -174,3 +176,15 @@ func Unique(intSlice []int) []int {
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
func GetNetwork() (string, string) {
|
||||
del := ""
|
||||
nt := viper.GetString("NETWORK_TYPE")
|
||||
port := viper.GetString("MPD_PORT")
|
||||
if nt == "tcp" {
|
||||
del = ":"
|
||||
} else if nt == "unix" && port != "" {
|
||||
port = ""
|
||||
}
|
||||
return nt, viper.GetString("NETWORK_ADDRESS") + del + port
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user