예제 #1
0
파일: main.go 프로젝트: firebitsbr/wikifeat
func main() {
	// Get command line arguments
	configFile := flag.String("config", "config.ini", "config file to load")
	flag.Parse()
	// Load configuration
	config.LoadConfig(*configFile)
	// Set up logger
	log.SetOutput(&lumberjack.Logger{
		Filename:   config.Logger.LogFile,
		MaxSize:    config.Logger.MaxSize,
		MaxBackups: config.Logger.MaxBackups,
		MaxAge:     config.Logger.MaxAge,
	})
	wsContainer := restful.NewContainer()
	wsContainer.Router(restful.CurlyRouter{})
	//Enable Gzip support
	wsContainer.EnableContentEncoding(true)
	uc := user_service.UsersController{}
	uc.Register(wsContainer)
	services.InitDb()
	registry.Init("Users", registry.UsersLocation)
	httpAddr := ":" + config.Service.Port
	if config.Service.UseSSL == true {
		certFile := config.Service.SSLCertFile
		keyFile := config.Service.SSLKeyFile
		log.Fatal(http.ListenAndServeTLS(httpAddr,
			certFile, keyFile, wsContainer))
	} else {
		log.Fatal(http.ListenAndServe(httpAddr, wsContainer))
	}
}
예제 #2
0
파일: main.go 프로젝트: firebitsbr/wikifeat
func main() {
	// Get Command line arguments
	configFile := flag.String("config", "config.ini", "config file to load")
	flag.Parse()
	// Load configuration
	config.LoadConfig(*configFile)
	fserv.LoadPluginData(config.Frontend.PluginDir + "/plugins.ini")
	services.InitDb()
	// Set up the core logger
	log.SetOutput(&lumberjack.Logger{
		Filename:   config.Logger.LogFile,
		MaxSize:    config.Logger.MaxSize,
		MaxBackups: config.Logger.MaxBackups,
		MaxAge:     config.Logger.MaxAge,
	})
	registry.Init("Frontend", registry.FrontEndLocation)
	routing.Start()
}