Documentation ¶
Index ¶
- func Contains[T comparable](s []T, e T) bool
- func DefaultServeMuxOptions(s ...GRPCServer) []runtime.ServeMuxOption
- func EmbedFSToOSFS(prefix string, fs embed.FS, fsDirectory string) ([]string, error)
- func GetTemporalClientFromFlags(ctx *cli.Context, opts client.Options) (client.Client, error)
- func GithubGrpcInterceptor(team string) (grpc.UnaryServerInterceptor, error)
- func LogErrorf(format string, args ...interface{})
- func NameGen(prefix string) string
- func NewDBArgs(keyval ...any) *orderedmap.OrderedMap[string, any]
- func NewTemporalClient(host string, namespace string, taskQueue string, opts client.Options) (client.Client, error)
- func Pointer[T any](v T) *T
- func RareUseChangeDefault(envVar string, newDefault string)
- func SliceToPB[T any, U internalGetPb[T]](slice []U) []T
- func SqlNullString(s sql.NullString) *wrapperspb.StringValue
- func SqlNullTime(t sql.NullTime) *timestamppb.Timestamp
- func WithDatabaseFlags(appName string) []cli.Flag
- func WithFlags(flags ...[]cli.Flag) []cli.Flag
- func WithGatewayFlags(defaultPort int) []cli.Flag
- func WithGrpcFlags(defaultPort int) []cli.Flag
- func WithStorageFlags() []cli.Flag
- func WithTemporalFlags(defaultNamespace string, defaultTaskQueue string) []cli.Flag
- type DB
- type EnvVar
- type FrontendInfo
- type GRPCServer
- type GRPCServerOption
- func FlagsToGRPCServerOptions(ctx *cli.Context) []GRPCServerOption
- func WithDialOptions(opts ...grpc.DialOption) GRPCServerOption
- func WithGRPCPort(port int) GRPCServerOption
- func WithGatewayPort(port int) GRPCServerOption
- func WithIncomingHeaders(headers ...string) GRPCServerOption
- func WithMuxOptions(opts ...runtime.ServeMuxOption) GRPCServerOption
- func WithNoGRPCGateway() GRPCServerOption
- func WithNoMetrics() GRPCServerOption
- func WithOutgoingHeaders(headers ...string) GRPCServerOption
- func WithServeMuxAdditionalHeaders(headers ...string) GRPCServerOption
- func WithServerOptions(opts ...grpc.ServerOption) GRPCServerOption
- func WithStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) GRPCServerOption
- func WithTimeout(timeout time.Duration) GRPCServerOption
- func WithUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) GRPCServerOption
- type GrpcEndpointRegister
- type Pika
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](s []T, e T) bool
func DefaultServeMuxOptions ¶
func DefaultServeMuxOptions(s ...GRPCServer) []runtime.ServeMuxOption
func EmbedFSToOSFS ¶
EmbedFSToOSFS re-creates the structure of the embed.FS in the OS filesystem. It is mostly useful for testing but other uses are possible. This function takes a prefix / directory and an embed.FS and creates the corresponding directory structure in the OS filesystem. Returns all created file paths.
func GetTemporalClientFromFlags ¶
GetTemporalClientFromFlags gets the temporal client from the cli flags.
func GithubGrpcInterceptor ¶
func GithubGrpcInterceptor(team string) (grpc.UnaryServerInterceptor, error)
GithubGrpcInterceptor is a gRPC interceptor that checks for a valid GitHub token and that the user is in the given team
func LogErrorf ¶
func LogErrorf(format string, args ...interface{})
LogErrorf logs an error message todo(mustafa): remove this and use slog.Error properly deprecated
func NewDBArgs ¶
func NewDBArgs(keyval ...any) *orderedmap.OrderedMap[string, any]
func NewTemporalClient ¶
func RareUseChangeDefault ¶
RareUseChangeDefault changes the default value of an arbitrary environment variable.
func SqlNullString ¶
func SqlNullString(s sql.NullString) *wrapperspb.StringValue
func SqlNullTime ¶
func SqlNullTime(t sql.NullTime) *timestamppb.Timestamp
func WithDatabaseFlags ¶
func WithDatabaseFlags(appName string) []cli.Flag
func WithGatewayFlags ¶
func WithGatewayFlags(defaultPort int) []cli.Flag
func WithGrpcFlags ¶
func WithGrpcFlags(defaultPort int) []cli.Flag
func WithStorageFlags ¶
func WithStorageFlags() []cli.Flag
WithStorageFlags adds the storage flags to the app.
func WithTemporalFlags ¶
Types ¶
type DB ¶
type DB struct {
*pika.PostgreSQL
}
func GetDBFromFlags ¶
func GetDBFromFlags(ctx *cli.Context) *DB
GetDBFromFlags gets the database from the cli flags.
type EnvVar ¶
type EnvVar string
const ( EnvVarGRPCPort EnvVar = "GRPC_PORT" EnvVarGatewayPort EnvVar = "GATEWAY_PORT" EnvVarDatabaseURI EnvVar = "DATABASE_URI" EnvVarTemporalNamespace EnvVar = "TEMPORAL_NAMESPACE" EnvVarTemporalAddress EnvVar = "TEMPORAL_ADDRESS" EnvVarTemporalTaskQueue EnvVar = "TEMPORAL_TASK_QUEUE" EnvVarStorageEndpoint EnvVar = "STORAGE_ENDPOINT" EnvVarStorageConnectionString EnvVar = "STORAGE_CONNECTION_STRING" EnvVarStorageRegion EnvVar = "STORAGE_REGION" EnvVarStorageSecure EnvVar = "STORAGE_SECURE" EnvVarStoragePathStyle EnvVar = "STORAGE_PATH_STYLE" )
type FrontendInfo ¶
type FrontendInfo struct { // NoRun is a flag to disable running the frontend server NoRun bool // MuxHandler is the HTTP handler (can be nil) MuxHandler http.Handler // Title to add to the HTML page Title string // Port is the port to serve the frontend on Port int // Self is the URL to the frontend server Self string // NoAuth is a flag to disable authentication NoAuth bool // AllowUnauthenticated is a flag to allow unauthenticated users AllowUnauthenticated bool // OIDCIssuer is the issuer to use for authentication OIDCIssuer string // OIDCClientID is the client ID to use for authentication OIDCClientID string // OIDCClientSecret is the client secret to use for authentication OIDCClientSecret string // OIDCGroup is the group to check for authentication OIDCGroup string // OIDCUserInfoOverride is a flag to override the userinfo endpoint // todo(mustafa): we don't need to use it yet since RESF deploys cluster external Keycloak. OIDCUserInfoOverride string }
type GRPCServer ¶
type GRPCServer struct {
// contains filtered or unexported fields
}
func NewGRPCServer ¶
func NewGRPCServer(opts ...GRPCServerOption) (*GRPCServer, error)
NewGRPCServer creates a new gRPC-server with gRPC-gateway, default interceptors and exposed Prometheus metrics.
func (*GRPCServer) GatewayEndpoints ¶
func (g *GRPCServer) GatewayEndpoints(registerEndpoints ...GrpcEndpointRegister) error
func (*GRPCServer) GatewayMux ¶
func (g *GRPCServer) GatewayMux() *runtime.ServeMux
func (*GRPCServer) RegisterService ¶
func (g *GRPCServer) RegisterService(register func(*grpc.Server))
func (*GRPCServer) Start ¶
func (g *GRPCServer) Start() error
type GRPCServerOption ¶
type GRPCServerOption func(*GRPCServer)
func FlagsToGRPCServerOptions ¶
func FlagsToGRPCServerOptions(ctx *cli.Context) []GRPCServerOption
FlagsToGRPCServerOptions converts the cli flags to gRPC server options.
func WithDialOptions ¶
func WithDialOptions(opts ...grpc.DialOption) GRPCServerOption
WithDialOptions sets the gRPC dial options. (Append)
func WithGRPCPort ¶
func WithGRPCPort(port int) GRPCServerOption
WithGRPCPort sets the gRPC port for the gRPC server.
func WithGatewayPort ¶
func WithGatewayPort(port int) GRPCServerOption
WithGatewayPort sets the gRPC-gateway port for the gRPC server.
func WithIncomingHeaders ¶
func WithIncomingHeaders(headers ...string) GRPCServerOption
WithIncomingHeaders sets the incoming headers for the gRPC-gateway. (Append)
func WithMuxOptions ¶
func WithMuxOptions(opts ...runtime.ServeMuxOption) GRPCServerOption
WithMuxOptions sets the gRPC-gateway mux options. (Append)
func WithNoGRPCGateway ¶
func WithNoGRPCGateway() GRPCServerOption
WithNoGRPCGateway disables the gRPC-gateway for the gRPC server.
func WithNoMetrics ¶
func WithNoMetrics() GRPCServerOption
WithNoMetrics disables the Prometheus metrics for the gRPC server.
func WithOutgoingHeaders ¶
func WithOutgoingHeaders(headers ...string) GRPCServerOption
WithOutgoingHeaders sets the outgoing headers for the gRPC-gateway. (Append)
func WithServeMuxAdditionalHeaders ¶
func WithServeMuxAdditionalHeaders(headers ...string) GRPCServerOption
WithServeMuxAdditionalHeaders sets additional headers for the gRPC-gateway. (incoming)
func WithServerOptions ¶
func WithServerOptions(opts ...grpc.ServerOption) GRPCServerOption
WithServerOptions sets the gRPC server options. (Append)
func WithStreamInterceptors ¶
func WithStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) GRPCServerOption
WithStreamInterceptors sets the gRPC stream interceptors. (Append)
func WithTimeout ¶
func WithTimeout(timeout time.Duration) GRPCServerOption
WithTimeout sets the timeout for the gRPC server.
func WithUnaryInterceptors ¶
func WithUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) GRPCServerOption
WithUnaryInterceptors sets the gRPC unary interceptors. (Append)