server

package
v0.87.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotProto = fmt.Errorf("error not proto")
)

Functions

func Serve

func Serve(
	ctx context.Context,
	logger log.Logger,
	cfg Config,
	nrApp newrelic.Application,
	deps api.Deps,
	promRegistry *prometheus.Registry,
) error

func ServeConnect added in v0.66.0

func ServeConnect(ctx context.Context, logger log.Logger, cfg Config, deps api.Deps, promRegistry *prometheus.Registry) error

func ServeUI added in v0.8.17

func ServeUI(ctx context.Context, logger log.Logger, uiConfig UIConfig, apiServerConfig Config)

func WebhookBridgeHandler added in v0.87.1

func WebhookBridgeHandler(frontierHandler http.Handler) http.HandlerFunc

WebhookBridgeHandler creates an HTTP handler that bridges raw HTTP webhook requests to the ConnectRPC BillingWebhookCallback handler. This is needed because Stripe doesn't allow modifying the request body but allows custom URL paths. The handler uses the frontierHandler which has all interceptors (auth, logging, audit, etc.) applied.

Types

type Config

type Config struct {
	// Connect server config
	Connect ConnectConfig `yaml:"connect" mapstructure:"connect"`
	// port to listen HTTP requests on
	Port int `yaml:"port" mapstructure:"port" default:"8080"`

	// GRPC Config
	GRPC GRPCConfig `mapstructure:"grpc"`

	// metrics port
	MetricsPort int `yaml:"metrics_port" mapstructure:"metrics_port" default:"9000"`

	// Profiler enables /debug/pprof under metrics port
	Profiler bool `yaml:"profiler" mapstructure:"profiler" default:"false"`

	// the network interface to listen on
	Host string `yaml:"host" mapstructure:"host" default:"127.0.0.1"`

	// TODO might not suitable here because it is also being used by proxy
	// Headers which will have user's email id
	IdentityProxyHeader string `yaml:"identity_proxy_header" mapstructure:"identity_proxy_header" default:""`

	// ResourcesPath is a directory path where resources is defined
	// that this service should implement
	ResourcesConfigPath string `yaml:"resources_config_path" mapstructure:"resources_config_path"`

	// ResourcesPathSecretSecret could be an env name, file path or actual value required
	// to access ResourcesPathSecretPath files
	ResourcesConfigPathSecret string `yaml:"resources_config_path_secret" mapstructure:"resources_config_path_secret"`

	Authentication authenticate.Config `yaml:"authentication" mapstructure:"authentication"`

	// Deprecated: use Cors instead
	CorsOrigin []string `yaml:"cors_origin" mapstructure:"cors_origin"`
	// Cors configuration setup origin value from where we want to allow cors
	// headers and methods are the list of headers and methods we want to allow
	Cors        interceptors.CorsConfig        `yaml:"cors" mapstructure:"cors"`
	ConnectCors connectinterceptors.CorsConfig `yaml:"cors" mapstructure:"cors"`

	Admin bootstrap.AdminConfig `yaml:"admin" mapstructure:"admin"`

	Mailer mailer.Config `yaml:"mailer" mapstructure:"mailer"`

	Webhook webhook.Config `yaml:"webhook" mapstructure:"webhook"`
}

type ConnectConfig added in v0.66.0

type ConnectConfig struct {
	// port to listen buf connect requests on
	Port int `yaml:"port" mapstructure:"port" default:"8002"`
}

type GRPCConfig

type GRPCConfig struct {
	Port            int    `mapstructure:"port" default:"8081"`
	MaxRecvMsgSize  int    `mapstructure:"max_recv_msg_size" default:"33554432"`
	MaxSendMsgSize  int    `mapstructure:"max_send_msg_size" default:"33554432"`
	TLSCertFile     string `mapstructure:"tls_cert_file" default:""`
	TLSKeyFile      string `mapstructure:"tls_key_file" default:""`
	TLSClientCAFile string `mapstructure:"tls_client_ca_file" default:""`
}

type UIConfig added in v0.8.17

type UIConfig struct {
	Port              int            `yaml:"port" mapstructure:"port"`
	Title             string         `yaml:"title" mapstructure:"title"`
	AppURL            string         `yaml:"app_url" mapstructure:"app_url"`
	TokenProductId    string         `yaml:"token_product_id" mapstructure:"token_product_id"`
	OrganizationTypes []string       `yaml:"organization_types" mapstructure:"organization_types"`
	Webhooks          WebhooksConfig `yaml:"webhooks" mapstructure:"webhooks"`
}

type UIConfigApiResponse added in v0.47.0

type UIConfigApiResponse struct {
	Title             string                    `json:"title"`
	AppUrl            string                    `json:"app_url"`
	TokenProductId    string                    `json:"token_product_id"`
	OrganizationTypes []string                  `json:"organization_types"`
	Webhooks          WebhooksConfigApiResponse `json:"webhooks"`
}

type WebhooksConfig added in v0.77.0

type WebhooksConfig struct {
	EnableDelete bool `yaml:"enable_delete" mapstructure:"enable_delete" default:"false"`
}

type WebhooksConfigApiResponse added in v0.77.0

type WebhooksConfigApiResponse struct {
	EnableDelete bool `json:"enable_delete"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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