コード例 #1
0
func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	staticData, err := getStaticAppData()
	if err != nil {
		log.Printf("ERROR failed to get static app data: %v", err)
		return
	}

	opsConfigFile := flag.String("opsCfg", "", "The traffic ops config file")
	flag.Parse()

	if *opsConfigFile == "" {
		fmt.Println("The --opsCfg argument is required")
		os.Exit(1)
	}

	// Start the Manager
	manager.Start(*opsConfigFile, staticData)
}
コード例 #2
0
func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())

	staticData, err := getStaticAppData()
	if err != nil {
		fmt.Printf("Error starting service: failed to get static app data: %v\n", err)
		os.Exit(1)
	}

	opsConfigFile := flag.String("opsCfg", "", "The traffic ops config file")
	configFileName := flag.String("config", "", "The Traffic Monitor config file path")
	flag.Parse()

	if *opsConfigFile == "" {
		fmt.Println("Error starting service: The --opsCfg argument is required")
		os.Exit(1)
	}

	// TODO add hot reloading (like opsConfigFile)?
	cfg, err := config.Load(*configFileName)
	if err != nil {
		fmt.Printf("Error starting service: failed to load config: %v\n", err)
		os.Exit(1)
	}

	errW, warnW, infoW, debugW, err := getLogWriters(cfg.LogLocationError, cfg.LogLocationWarning, cfg.LogLocationInfo, cfg.LogLocationDebug)
	if err != nil {
		fmt.Printf("Error starting service: failed to create log writers: %v\n", err)
		os.Exit(1)
	}
	log.Init(errW, warnW, infoW, debugW)

	log.Infof("Starting with config %+v\n", cfg)

	manager.Start(*opsConfigFile, cfg, staticData)
}