Skip to content

Commit

Permalink
add root path handler for rainbow
Browse files Browse the repository at this point in the history
  • Loading branch information
bnewbold committed Nov 19, 2024
1 parent 2c8d601 commit 655eb49
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions splitter/splitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,11 @@ func (s *Splitter) StartWithListener(listen net.Listener) error {
}
}

// TODO: this API is temporary until we formalize what we want here

e.GET("/xrpc/com.atproto.sync.subscribeRepos", s.EventsHandler)

e.GET("/xrpc/_health", s.HandleHealthCheck)
e.GET("/_health", s.HandleHealthCheck)
e.GET("/", s.HandleHomeMessage)

// In order to support booting on random ports in tests, we need to tell the
// Echo instance it's already got a port, and then use its StartServer
Expand All @@ -218,6 +219,21 @@ func (s *Splitter) HandleHealthCheck(c echo.Context) error {
return c.JSON(200, HealthStatus{Status: "ok"})
}

var homeMessage string = `
_ _
_ _ __ _(_)_ _ | |__ _____ __ __
| '_/ _' | | ' \| '_ \/ _ \ V V /
|_| \__,_|_|_||_|_.__/\___/\_/\_/
This is an atproto [https://atproto.com] firehose fanout service, running the 'rainbow' codebase [https://github.com/bluesky-social/indigo]
The firehose WebSocket path is at: /xrpc/com.atproto.sync.subscribeRepos
`

func (s *Splitter) HandleHomeMessage(c echo.Context) error {
return c.String(http.StatusOK, homeMessage)
}

func (s *Splitter) EventsHandler(c echo.Context) error {
var since *int64
if sinceVal := c.QueryParam("cursor"); sinceVal != "" {
Expand Down

0 comments on commit 655eb49

Please sign in to comment.