Refactoring HTTP Gate

- simplify code
- add `/get_by_attribute`
- refactoring receiving object

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
Evgeniy Kulikov 2020-12-03 18:00:43 +03:00
parent b6a9654546
commit abd95efe47
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2
2 changed files with 118 additions and 41 deletions

4
app.go
View file

@ -175,7 +175,9 @@ func (a *app) Serve(ctx context.Context) {
r.RedirectTrailingSlash = true
a.log.Info("enabled /get/{cid}/{oid}")
r.GET("/get/{cid}/{oid}", a.receiveFile)
r.GET("/get/{cid}/{oid}", a.byAddress)
a.log.Info("enabled /get_by_attribute/{cid}/{attr_key}/{attr_val}")
r.GET("/get_by_attribute/{cid}/{attr_key}/{attr_val}", a.byAttribute)
// attaching /-/(ready,healthy)
attachHealthy(r, a.pool.Status)