build: add build tags to create customizable binaries

This commit is contained in:
Shivam Mishra
2020-10-14 14:47:20 -07:00
parent 17dce7e63b
commit 46beb30fc1
27 changed files with 213 additions and 92 deletions
+2 -8
View File
@@ -21,10 +21,9 @@ import (
"strconv"
"strings"
gqlHandler "github.com/99designs/gqlgen/graphql/handler"
_ "github.com/anuvu/zot/docs" // as required by swaggo
"github.com/anuvu/zot/errors"
"github.com/anuvu/zot/pkg/extensions/search"
ext "github.com/anuvu/zot/pkg/extensions"
"github.com/anuvu/zot/pkg/log"
"github.com/gorilla/mux"
jsoniter "github.com/json-iterator/go"
@@ -52,11 +51,6 @@ func NewRouteHandler(c *Controller) *RouteHandler {
return rh
}
func (rh *RouteHandler) searchHandler() *gqlHandler.Server {
resConfig := search.GetResolverConfig(rh.c.Config.Storage.RootDirectory, rh.c.Log, rh.c.ImageStore)
return gqlHandler.NewDefaultServer(search.NewExecutableSchema(resConfig))
}
func (rh *RouteHandler) SetupRoutes() {
rh.c.Router.Use(AuthHandler(rh.c))
g := rh.c.Router.PathPrefix(RoutePrefix).Subrouter()
@@ -96,7 +90,7 @@ func (rh *RouteHandler) SetupRoutes() {
rh.c.Router.PathPrefix("/swagger/v2/").Methods("GET").Handler(httpSwagger.WrapHandler)
// Zot Search Extension Router
if rh.c.Config != nil && rh.c.Config.Extensions != nil {
rh.c.Router.PathPrefix("/query").Methods("GET", "POST").Handler(rh.searchHandler())
ext.SetupRoutes(rh.c.Router, rh.c.Config.Storage.RootDirectory, rh.c.ImageStore, rh.c.Log)
}
}