Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadFile ¶
LoadFile loads a file at the specified URL using the corresponding registered FileLoader. If no scheme is specified, LocalLoader is used.
func RegisterFileLoaderCtor ¶
func RegisterFileLoaderCtor(scheme string, ctr FileLoaderCtor)
RegisterFileLoaderCtor registers a FileLoader for the specified scheme.
Types ¶
type App ¶
type App interface { // Init initializes the application in a blocking fashion. When Init returns, it // is expected that the application is ready to start receiving requests (provided // there are gRPC handlers installed). Init(config Config) error // RegisterWithGRPC provides a mechanism for the application to register gRPC services // with the gRPC server. RegisterWithGRPC(server *grpc.Server) // ShutdownChan returns a channel that is closed when the application is shutdown. // // If the channel is closed, the gRPC server will initiate a shutdown if it has // not already done so. ShutdownChan() <-chan struct{} // Stop stops the service, allowing for it to clean up any resources. When Stop() // returns, the process exits. // // Stop should be idempotent. Stop() }
App is a long lived application that services network requests. It is expected that App's have gRPC services, but is not a hard requirement.
The lifecycle of the App is tied to the process. The app gets initialized before the gRPC server runs, and gets stopped after the gRPC server has stopped serving.
type BaseConfig ¶
type BaseConfig struct { LogLevel string `mapstructure:"log_level"` LogType string `mapstructure:"log_type"` ListenAddress string `mapstructure:"listen_address"` InsecureListenAddress string `mapstructure:"insecure_listen_address"` ShutdownGracePeriod time.Duration `mapstructure:"shutdown_grace_period"` HTTPGatewayAddress string `mapstructure:"http_gateway_address"` // TLSCertificate is an optional URL that specified a TLS certificate to be // used for the gRPC server. // // Currently only two supported URL schemes are supported: file, s3. // If no scheme is specified, file is used. TLSCertificate string `mapstructure:"tls_certificate"` // TLSKey is an optional URL that specifies a TLS Private Key to be used for the // gRPC server. // // Currently only two supported URL schemes are supported: file, s3. // If no scheme is specified, file is used. TLSKey string `mapstructure:"tls_private_key"` EnablePprof bool `mapstructure:"enable_pprof"` EnableExpvar bool `mapstructure:"enable_expvar"` DebugListenAddress string `mapstructure:"debug_listen_address"` // Arbitrary configuration that the service can define / implement. // // Users should use mapstructure.Decode for ServiceConfig. AppConfig Config `mapstructure:"app"` }
BaseConfig contains the base configuration for agora services, as well as the application itself.
type Config ¶
type Config map[string]interface{}
Config is the application specific configuration. It is passed to the App.Init function, and is optional.
type FileLoader ¶
FileLoader loads files at a specified URL.
type FileLoaderCtor ¶
type FileLoaderCtor func() (FileLoader, error)
FileLoaderCtor constructs a FileLoader.
type LocalLoader ¶
type LocalLoader struct{}
LocalLoader is a FileLoader that loads file from the local filesystem.
type Option ¶
type Option func(o *opts)
Option configures the environment run by Run().
func WithHTTPGatewayEnabled ¶ added in v0.52.0
func WithHTTPGatewayEnabled(enabled bool, muxOpts ...httpgateway.MuxOption) Option
WithHTTPGatewayEnabled configures whether or not an HTTP gateway should be enabled with the provided options.
func WithStreamServerInterceptor ¶
func WithStreamServerInterceptor(interceptor grpc.StreamServerInterceptor) Option
WithStreamServerInterceptor configures the app's gRPC server to use the provided interceptor.
Interceptors are evaluated in addition order, and configured interceptors are executed after the app's default interceptors.
func WithUnaryServerInterceptor ¶
func WithUnaryServerInterceptor(interceptor grpc.UnaryServerInterceptor) Option
WithUnaryServerInterceptor configures the app's gRPC server to use the provided interceptor.
Interceptors are evaluated in addition order, and configured interceptors are executed after the app's default interceptors.