コード例 #1
0
func (s *Service) Initialize() {
	// Get options from process arguments
	c := getOptions()

	s.Port = c.Port

	// Initialize store
	s.Store = store.New()
	s.Store.InitializeState()

	// Initialize service engine
	s.Engine = gin.Default()

	s.Engine.Use(gin.Logger())
	s.Engine.Use(gin.Recovery())

	routes.AddRepoRoutes(s.Store, s.Engine)
}
コード例 #2
0
func (s *Service) Initialize() {
	// Get options from process arguments
	c := getOptions()

	s.Port = c.Port

	// Initialize vulcan client
	s.VulcandClient = utils.NewVulcandClient(s.Name, s.Port, 10*time.Second)

	// Initialize store
	s.Store = store.New()
	s.Store.InitializeState()

	// Initialize service engine
	s.Router = gin.Default()

	s.Router.Use(gin.Logger())
	s.Router.Use(gin.Recovery())

	routes.AddRepoRoutes(s.Store, s.Router)
}