Skip to content

Commit

Permalink
restructure search endpoint registration
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Sep 7, 2020
1 parent fae0644 commit c12c32f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,15 @@ func main() {
//
// initialize file database in background

htp.Register("/search", "GET", handler.HandleSearch)
htp.Register("/api/search", "GET", handler.HandleSearchAPI)

go func() {
if len(idata.Config.SearchOn) > 0 {
for _, item := range idata.Config.SearchOn {
fsdb.Init(idata.DataPathsPub, item)
fsdb.Init(idata.DataPathsPrv, item)
}
if len(idata.Config.SearchOn) > 0 {
htp.Register("/search", "GET", handler.HandleSearch)
htp.Register("/api/search", "GET", handler.HandleSearchAPI)

for _, item := range idata.Config.SearchOn {
go fsdb.Init(idata.DataPathsPub, item)
go fsdb.Init(idata.DataPathsPrv, item)
}
}()
}
if len(idata.Config.SearchOff) > 0 {
for _, item := range idata.Config.SearchOff {
fsdb.DeInit(idata.DataPathsPub, item)
Expand Down

0 comments on commit c12c32f

Please sign in to comment.