Documentation ¶
Index ¶
- Variables
- func CLICmd(name string, opts ...OptFunc) *cli.Command
- func FlagsAndAction(optsargs ...OptFunc) ([]cli.Flag, func(c *cli.Context) error, *cliopts)
- func MustStart(opts ...OptFunc) <-chan error
- func Run(opts ...OptFunc)
- func RunCLI(name string, opts ...OptFunc)
- func SetVersion(v *Version)
- func Start(opts ...OptFunc) (<-chan error, error)
- type CLIOptFunc
- type Component
- type Flags
- type GRPCAddr
- type GRPCOptions
- type OptFunc
- func Provide(p interface{}) OptFunc
- func WithCLIOptions(fs ...CLIOptFunc) OptFunc
- func WithComponent(comps ...Component) OptFunc
- func WithConfig(cfg interface{}) OptFunc
- func WithDefaultDisable(ns ...string) OptFunc
- func WithFlags(f *Flags) OptFunc
- func WithGRPC(enabled bool) OptFunc
- func WithHTTP(enabled bool) OptFunc
- func WithInit(n string, f interface{}) OptFunc
- func WithLogger(l func() L.L) OptFunc
- func WithName(name string) OptFunc
- func WithReady(n string, f interface{}) OptFunc
- func WithSetup(n string, f interface{}) OptFunc
- func WithStart(n string, f interface{}) OptFunc
- type Providers
- type SvcCfg
- type Version
Constants ¶
This section is empty.
Variables ¶
var DefaultServiceName = filepath.Base(os.Args[0])
Functions ¶
func FlagsAndAction ¶
func SetVersion ¶
func SetVersion(v *Version)
func Start ¶
Start the service. Returns a channel for asynchronous error handling, for example in case of a failure of the GRPC server itself.
The startup is done in the following order: 1. Configuration loading (both user specified and service); 2. Log initializations. 3. Call user Init functions. 4. If -setup is specified, call user Setup functions. 5. If -exit-before-start is not specified, call user Start functions.
Types ¶
type CLIOptFunc ¶
type CLIOptFunc func(*cliopts)
func WithCLIApp ¶
func WithCLIApp(f func(*cli.App)) CLIOptFunc
func WithCLICommand ¶
func WithCLICommand(cmd *cli.Command) CLIOptFunc
func WithCLIFlags ¶
func WithCLIFlags(flags []cli.Flag) CLIOptFunc
func WithCLIPreaction ¶
func WithCLIPreaction(f func(c *cli.Context) error) CLIOptFunc
type Component ¶
A component is a grouping of init/setup/start record that conceptually belong to a specific component with a name.
type GRPCOptions ¶
type GRPCOptions struct {
// contains filtered or unexported fields
}
Specified GRPC Server Options for the server. Can only be used by the Init phase. Can be used, for example, to add interceptors by components.
func (*GRPCOptions) Add ¶
func (g *GRPCOptions) Add(opts ...grpc.ServerOption)
type OptFunc ¶
type OptFunc func(*opts)
func Provide ¶
func Provide(p interface{}) OptFunc
Explicitly provide a new provider before initialization.
func WithCLIOptions ¶
func WithCLIOptions(fs ...CLIOptFunc) OptFunc
func WithComponent ¶
func WithConfig ¶
func WithConfig(cfg interface{}) OptFunc
Load cfg from environment using envconfig before anything else.
func WithDefaultDisable ¶
Disable components by default unless enabled from cmdline.