Esempio n. 1
0
File: main.go Progetto: slok/daton
func main() {
	//	go func() {
	//		log.Println(http.ListenAndServe("0.0.0.0:6060", nil))
	//	}()

	log.Info("Starting Daton...")

	// Load configuration
	configuration.LoadSettingsFromFile()

	// Init database
	db, err := data.GetBoltDb()
	defer db.Disconnect()
	if err != nil {
		log.Panic("Couldn't connect to bolt database")
	}

	// Bind routing with handlers
	router := api.BindApiRoutes(nil)

	// serve
	n := negroni.Classic()
	n.UseHandler(router)

	listenAddress := fmt.Sprintf(":%d", viper.GetInt("Port"))
	n.Run(listenAddress)
}
Esempio n. 2
0
func (s *DeploymentsApiRoutesTestSuite) TearDownTest(c *C) {
	db, _ := data.GetBoltDb()
	db.Disconnect()

	// Delete the database (if present)
	err := os.RemoveAll(viper.GetString("BoltdbName"))
	if err != nil {
		panic(err)
	}
}