Ejemplo n.º 1
0
func initializeConfig(c *skynet.ServiceConfig) {
	if c.Log == nil {
		c.Log = skynet.NewConsoleLogger(os.Stderr)
	}

	if c.Name == "" {
		c.Name = "SkynetService"
	}

	if c.Version == "" {
		c.Version = "1"
	}

	if c.Region == "" {
		c.Region = "local"
	}

	if c.ServiceAddr.IPAddress == "" {
		c.ServiceAddr.IPAddress = "127.0.0.1"
	}

	if c.ServiceAddr.Port == 0 {
		c.ServiceAddr.Port = 9000
	}

	if c.DoozerConfig == nil {
		c.DoozerConfig = &skynet.DoozerConfig{
			Uri:          "127.0.0.1:8046",
			AutoDiscover: true,
		}
	}
}
Ejemplo n.º 2
0
func initializeConfig(c *skynet.ServiceConfig) {
	if c.Log == nil {
		c.Log = skynet.NewConsoleSemanticLogger("skynet", os.Stderr)
	}

	if c.Name == "" {
		c.Name = "SkynetService"
	}

	if c.Version == "" {
		c.Version = "1"
	}

	if c.Region == "" {
		c.Region = "local"
	}

	if c.ServiceAddr == nil {
		c.ServiceAddr = &skynet.BindAddr{}
	}

	if c.ServiceAddr.IPAddress == "" {
		c.ServiceAddr.IPAddress = "127.0.0.1"
	}

	if c.ServiceAddr.Port == 0 {
		c.ServiceAddr.Port = 9000
	}
	if c.ServiceAddr.MaxPort == 0 {
		c.ServiceAddr.MaxPort = 9999
	}

	if c.DoozerConfig == nil {
		c.DoozerConfig = &skynet.DoozerConfig{
			Uri:          "127.0.0.1:8046",
			AutoDiscover: true,
		}
	}

	if c.DoozerUpdateInterval == 0 {
		c.DoozerUpdateInterval = 5 * time.Second
	}
}