Example #1
0
func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	subscription := account.NewEtcdSubscription("/maestro_development", &db.EtcdConfig{Machines: []string{"http://localhost:2379"}})
	api := api.NewApi(mem.New(), subscription)

	api.AddHook(account.Hook{
		Name:   "backstage-maestro-slack",
		Team:   account.ALL_TEAMS,
		Events: []string{"service.create"},
		Config: account.HookConfig{Address: "http://localhost:8001"},
		// Text: `{"username": "******", "channel": "#backstage",
		// "icon_url": "http://www.albertoleal.me/images/maestro-pq.png",
		// "text": "Um novo serviço foi criado no Backstage Maestro, com o seguinte subdomínio: {{.Service.Subdomain}}."}`,
	})

	api.ListenEvents()
	api.Run()
}
Example #2
0
func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())

	settings := &gateway.Settings{
		Host: "backstage.example.org",
		Port: ":8001",
	}

	one := &account.Service{Endpoint: "http://localhost:9999", Subdomain: "one", Timeout: 2}
	hw := &account.Service{Endpoint: "http://gohttphelloworld.appspot.com", Subdomain: "helloworld", Timeout: 2}
	services := []*account.Service{one, hw}

	pubsub := account.NewEtcdSubscription("/maestro_development", &db.EtcdConfig{Machines: []string{"http://localhost:2379"}})
	gw := gateway.New(settings, pubsub)
	gw.LoadServices(services)
	gw.RefreshServices()
	gw.Run()
}
Example #3
0
func (s *S) SetUpSuite(c *C) {
	Logger.Disable()
	// FIXME: add memory
	s.pubsub = account.NewEtcdSubscription("/api_test", &db.EtcdConfig{Machines: []string{"http://localhost:2379"}})
}