@@ -117,6 +117,26 @@ func NewApiServer(config config.Config) *ApiServer {
117117 app .Use (app .resolveMyIdMiddleware )
118118 app .Use (app .authMiddleware )
119119
120+ // some not-yet-implemented routes will match handlers below
121+ // and won't fall thru to python reverse proxy handler
122+ // so add some exclusions here to make `bridge.audius.co` less broken
123+ // todo: implement these endpoints in bridgerton.
124+ {
125+ app .Use ("/v1/full/users/top" , BalancerForward (config .PythonUpstreams ))
126+ app .Use ("/v1/full/users/genre/top" , BalancerForward (config .PythonUpstreams ))
127+ app .Use ("/v1/full/users/subscribers" , BalancerForward (config .PythonUpstreams ))
128+
129+ app .Use ("/v1/full/playlists/top" , BalancerForward (config .PythonUpstreams ))
130+ app .Use ("/v1/full/playlists/trending" , BalancerForward (config .PythonUpstreams ))
131+
132+ app .Use ("/v1/full/tracks/best_new_releases" , BalancerForward (config .PythonUpstreams ))
133+ app .Use ("/v1/full/tracks/feeling_lucky" , BalancerForward (config .PythonUpstreams ))
134+ app .Use ("/v1/full/tracks/most_loved" , BalancerForward (config .PythonUpstreams ))
135+ app .Use ("/v1/full/tracks/remixables" , BalancerForward (config .PythonUpstreams ))
136+ app .Use ("/v1/full/tracks/usdc-purchase" , BalancerForward (config .PythonUpstreams ))
137+ app .Use ("/v1/full/tracks/trending/underground" , BalancerForward (config .PythonUpstreams ))
138+ }
139+
120140 v1 := app .Group ("/v1" )
121141 v1Full := app .Group ("/v1/full" )
122142
@@ -173,23 +193,7 @@ func NewApiServer(config config.Config) *ApiServer {
173193 app .Static ("/" , "./static" )
174194
175195 // proxy unhandled requests thru to existing discovery API
176- {
177- upstreams := []string {
178- "https://discoveryprovider.audius.co" ,
179- "https://discoveryprovider2.audius.co" ,
180- "https://discoveryprovider3.audius.co" ,
181- }
182- if os .Getenv ("ENV" ) == "stage" {
183- upstreams = []string {
184- "https://discoveryprovider.staging.audius.co" ,
185- "https://discoveryprovider2.staging.audius.co" ,
186- "https://discoveryprovider3.staging.audius.co" ,
187- "https://discoveryprovider5.staging.audius.co" ,
188- }
189- }
190-
191- app .Use (BalancerForward (upstreams ))
192- }
196+ app .Use (BalancerForward (config .PythonUpstreams ))
193197
194198 // gracefully handle 404
195199 // (this won't get hit so long as above proxy is in place)
@@ -210,6 +214,7 @@ type ApiServer struct {
210214
211215func (app * ApiServer ) home (c * fiber.Ctx ) error {
212216 return c .JSON (fiber.Map {
217+ "env" : config .Cfg .Env ,
213218 "started" : app .started ,
214219 "uptime" : time .Since (app .started ).Truncate (time .Second ).String (),
215220 })
0 commit comments