func (s *Adapter) UnmarshalYAML(unmarshal func(interface{}) error) error {
	type rawObj Adapter
	raw := rawObj{
		MaxConns:     200000,
		Protocol:     "tars",
		QueueCap:     10000,
		QueueTimeout: 60000,
		Threads:      5,
	}
	if err := unmarshal(&raw); err != nil {
		return err
	}
	*s = Adapter(raw)
	return nil
}
UnmarshalYAML defines a custom unmarsher for setting default values
package genconf
import (
	"bytes"
	"fmt"
	"io/ioutil"
	"path/filepath"
	"strings"
	"text/template"
	"github.com/tarscloud/k8stars/consts"
	"github.com/tarscloud/k8stars/mergeconf"
	"gopkg.in/yaml.v2"
)
type Adapter struct {
	Object       string `yaml:"object"`
	Endpoint     string `yaml:"endpoint"`
	MaxConns     int    `yaml:"maxconns"`
	Protocol     string `yaml:"protocol"`
	QueueCap     int    `yaml:"queuecap"`
	QueueTimeout int    `yaml:"queuetimeout"`
	Threads      int    `yaml:"threads"`
}
type ServerConf struct {
	Application string `yaml:"application"`
	Server      string `yaml:"server"`
	SetID       string `yaml:"set_id"`
	Locator string `yaml:"locator"`
	SampleRate              int    `yaml:"sample_rate"`
	MaxSampleCount          int    `yaml:"max_sample_count"`
	StatObj                 string `yaml:"statObj"`
	PropertyObj             string `yaml:"propertyObj"`
	AsyncThreadNum          int    `yaml:"asyncThreadNum"`
	SyncInvokeTimeout       int    `yaml:"sync_invoke_timeout"`
	AsyncInvokeTimeout      int    `yaml:"async_invoke_timeout"`
	ReportInterval          int    `yaml:"report_interval"`
	RefreshEndpointInterval int    `yaml:"refresh_endpoint_interval"`
	Adapters            []Adapter `yaml:"adapters"`
	LocalEndpoint       string    `yaml:"local"`
	LogSize             string    `yaml:"logSize"`
	LogNum              int       `yaml:"logNum"`
	ConfigObj           string    `yaml:"configObj"`
	NotifyObj           string    `yaml:"notifyObj"`
	LogObj              string    `yaml:"logObj"`
	LogLevel            string    `yaml:"logLevel"`
	DeactivatingTimeout int       `yaml:"deactivating_timeout"`
}
type GlobalConf struct {
	Conf      ServerConf `yaml:"conf"`
	EnableSet string     `yaml:"-"`
	Servant   string     `yaml:"-"`
	LocalIP   string     `yaml:"local_ip"`
	TarsPath  string     `yaml:"tars_path"`
}
func GetGlobalConf() (*GlobalConf, error) {
	sConfFile := filepath.Join(consts.TarsPath, "data", consts.ServerInfoFile)
	sConfBytes, err := ioutil.ReadFile(sConfFile)
	if err != nil {
		return nil, err
	}
	gConf := &GlobalConf{}
	if err := yaml.Unmarshal(sConfBytes, gConf); err != nil {
		return nil, err
	}
	return gConf, nil
}
func parseServerConf(f string, conf *ServerConf) error {
	bs, err := ioutil.ReadFile(f)
	if err != nil {
		return err
	}
	err = yaml.Unmarshal(bs, conf)
	return err
}
func defaultServerConf() ServerConf {
	return ServerConf{
		Locator:                 "tars.tarsregistry.QueryObj@tcp -h tars-registry.${namespace}.svc.cluster.local -p 17890",
		SampleRate:              100000,
		MaxSampleCount:          50,
		StatObj:                 "tars.tarsstat.StatObj",
		RefreshEndpointInterval: 60000,
		PropertyObj:             "tars.tarsproperty.PropertyObj",
		AsyncThreadNum:          3,
		SyncInvokeTimeout:       3000,
		AsyncInvokeTimeout:      5000,
		ReportInterval:          6000,
		LogSize:             "100M",
		LogNum:              5,
		ConfigObj:           "tars.tarsconfig.ConfigObj",
		NotifyObj:           "tars.tarsnotify.NotifyObj",
		LogObj:              "tars.tarslog.LogObj",
		LogLevel:            "DEBUG",
		DeactivatingTimeout: 3000,
		LocalEndpoint:       "tcp -h 127.0.0.1 -p ${random_port}",
	}
}