service

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RigProjectTokenHeader = "X-Rig-Project-Token"
)

Variables

View Source
var AllUsersAllow = map[string]struct{}{
	"/api.v1.authentication.Service": {},
}
View Source
var Module = fx.Module("service",
	fx.Provide(
		NewLogger,
		NewServer,
		NewAuthorization,
	),
)
View Source
var OmitAuth = map[string]struct{}{
	"/oauth/callback": {},

	"/api.v1.authentication.Service/Login":             {},
	"/api.v1.authentication.Service/Register":          {},
	"/api.v1.authentication.Service/VerifyEmail":       {},
	"/api.v1.authentication.Service/RefreshToken":      {},
	"/api.v1.authentication.Service/OauthCallback":     {},
	"/api.v1.authentication.Service/SendPasswordReset": {},
	"/api.v1.authentication.Service/ResetPassword":     {},
	"/api.v1.authentication.Service/GetAuthConfig":     {},

	"/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo": {},

	"/api/v1/status": {},
}
View Source
var OmitProjectToken = map[string]struct{}{
	"/api.v1.project.Service/Use":    {},
	"/api.v1.project.Service/Create": {},
	"/api.v1.project.Service/List":   {},

	"/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo": {},
}

Functions

func NewLogger

func NewLogger(cfg config.Config) (*zap.Logger, error)

Types

type Authorization

type Authorization struct {
	// contains filtered or unexported fields
}

func NewAuthorization

func NewAuthorization(logger *zap.Logger, as *service_auth.Service) *Authorization

type GRPCHandler

type GRPCHandler interface {
	ServiceName() string
	Build(opts ...connect.HandlerOption) (string, http.Handler)
}

type HTTPHandler

type HTTPHandler interface {
	Build() (string, string, HandlerFunc)
}

type HandlerFunc

type HandlerFunc func(w http.ResponseWriter, r *http.Request) error

type NewServerParams

type NewServerParams struct {
	fx.In

	Lifecycle      fx.Lifecycle
	Config         config.Config
	Logger         *zap.Logger
	Authentication *Authorization
	Telemetry      *telemetry.Telemetry

	GRPCHandlers []GRPCHandler `group:"grpc_handlers"`
	HTTPHandlers []HTTPHandler `group:"http_handlers"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(p NewServerParams) *Server

func (*Server) AddGRPCHandler

func (s *Server) AddGRPCHandler(p string, h http.Handler)

func (*Server) AddHTTPHandler

func (s *Server) AddHTTPHandler(method, p string, h HandlerFunc)

func (*Server) Address

func (s *Server) Address() string

func (*Server) EmbeddedFileServer

func (s *Server) EmbeddedFileServer()

func (*Server) Init

func (s *Server) Init()

func (*Server) Interceptors

func (s *Server) Interceptors() connect.Option

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL