Exemple #1
0
// NewAuthHandler returns an Auth Middleware with a gRPC
// connection to the Auth Service
func NewAuthHandler(authAddr *string) func(http.Handler) http.Handler {
	authClient := auth.NewAuthClient(mustDial(authAddr))

	return func(handler http.Handler) http.Handler {
		return authMiddleware{handler, authClient}
	}
}
Exemple #2
0
// newServer returns a server with initialization data loaded.
func newServer(authAddr, geoAddr, profileAddr, rateAddr *string) apiServer {
	return apiServer{
		serverName:    "api.v1",
		AuthClient:    auth.NewAuthClient(mustDial(authAddr)),
		GeoClient:     geo.NewGeoClient(mustDial(geoAddr)),
		ProfileClient: profile.NewProfileClient(mustDial(profileAddr)),
		RateClient:    rate.NewRateClient(mustDial(rateAddr)),
	}
}