github.com/timoth-y/kicksware-api/order-service@v0.0.0-20201002192818-87b546a7ae5a/container/factory/serverFactory.go (about)

     1  package factory
     2  
     3  import (
     4  	"github.com/go-chi/chi"
     5  
     6  	"github.com/timoth-y/kicksware-api/service-common/core"
     7  	"github.com/timoth-y/kicksware-api/service-common/server"
     8  
     9  	"github.com/timoth-y/kicksware-api/order-service/api/gRPC"
    10  	"github.com/timoth-y/kicksware-api/order-service/env"
    11  )
    12  
    13  func ProvideServer(config env.ServiceConfig, router chi.Router, handler *gRPC.Handler) core.Server {
    14  	srv := server.NewInstance(config.Common.Host)
    15  	srv.SetupEncryption(config.Security.TLSCertificate)
    16  	srv.SetupAuth(handler.ProvideAuthKey(), handler.ProvideAccessRoles())
    17  	srv.SetupREST(router)
    18  	srv.SetupGRPC(gRPC.ProvideRemoteSetup(handler))
    19  	return srv
    20  }