Files
Denis Arh 95e9bfda2a Fix discovery server build issues
Rename "aux" to "extra" due to:
> "aux" disallowed as path element component on Windows
2022-11-23 12:31:01 +01:00

35 lines
739 B
Go

package app
import (
searcherRest "github.com/cortezaproject/corteza/extra/server-discovery/searcher/rest"
"github.com/cortezaproject/corteza/server/pkg/options"
"github.com/go-chi/chi/v5"
"go.uber.org/zap"
"strings"
)
func (app *CortezaDiscoveryApp) MountHttpRoutes(r chi.Router) {
var (
ho = app.Opt.HTTPServer
)
func() {
if !app.Opt.Searcher.Enabled {
app.Log.Info("JSON REST API disabled")
return
}
r.Route(options.CleanBase(ho.ApiBaseUrl), func(r chi.Router) {
var fullPathAPI = "/" + strings.TrimPrefix(options.CleanBase(ho.BaseUrl, ho.ApiBaseUrl), "/")
app.Log.Info(
"JSON REST API enabled",
zap.String("baseUrl", fullPathAPI),
)
r.Route("/", searcherRest.MountRoutes())
})
}()
}