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() }
func (s *S) SetUpTest(c *C) { // setUpMongoreTest(s) setUpMemoryTest(s) s.api = api.NewApi(s.store, s.pubsub) s.server = httptest.NewServer(s.api.Handler()) httpClient = requests.NewHTTPClient(s.server.URL) team = account.Team{Name: "Backstage Team", Alias: "backstage"} service = account.Service{Endpoint: "http://example.org/api", Subdomain: "backstage"} user = account.User{Name: "Bob", Email: "*****@*****.**", Password: "******"} app = account.App{ClientId: "ios", ClientSecret: "secret", Name: "Ios App", Team: team.Alias, Owner: user.Email, RedirectUris: []string{"http://www.example.org/auth"}} pluginConfig = account.Plugin{Name: "Plugin Config", Service: service.Subdomain, Config: map[string]interface{}{"version": 1}} user.Create() token, err := s.api.Login(user.Email, "secret") if err != nil { panic(err) } s.authHeader = fmt.Sprintf("%s %s", token.Type, token.AccessToken) }