Source

aquchinchay / src / aquchinchay / server.go

Full commit
package aquchinchay

import (
	"aquchinchay/config"
	"aquchinchay/csp"
	"aquchinchay/status"
	"log"
)

func StartServer (globalConfig config.GlobalConfig) {
	serverStatus := status.NewServerStatus()
	resultChan := make(chan error, len(globalConfig.Servers))
	for _, serviceConfig := range(globalConfig.Servers) {
		service := csp.StartServer(globalConfig, serviceConfig, resultChan)
		serverStatus.AddService(service)
	}
	status.StartStatusApp(globalConfig.StatusAppAddress, serverStatus)
	err := <- resultChan
 	log.Panic(err)
}