Documentation ¶
Index ¶
- Variables
- func AddPrintConfigCmd(parser *flags.Parser, configName string)
- func InitDiagnosticsAndRecover(cfg DiagnosticsConfig) func()
- func InitLog(cfg LogConfig)
- func Must(err error, msg string, extra ...interface{})
- func MustParseArgs(parser *flags.Parser)
- func MustParseConfig(parser *flags.Parser, configName string)
- type AddCommandFunc
- type AddressConfig
- type ClientConfig
- type CommandRegistry
- type DiagnosticsConfig
- type EtcdConfig
- type LogConfig
- type ServiceConfig
- type ZoneConfig
Constants ¶
This section is empty.
Variables ¶
var BuildDate = "unknown"
BuildDate is populated at build with $(date +%F-%T-%Z).
var Version = "development"
Version is populated at build with $(git describe --dirty).
Functions ¶
func AddPrintConfigCmd ¶
func AddPrintConfigCmd(parser *flags.Parser, configName string)
AddPrintConfigCmd to the Parser. The "print-config" command helps users test whether their applications are correctly configured, by exporting all runtime configuration in INI format.
func InitDiagnosticsAndRecover ¶
func InitDiagnosticsAndRecover(cfg DiagnosticsConfig) func()
InitDiagnosticsAndRecover enables serving of metrics and debugging services registered on the default HTTPMux. It also returns a closure which should be deferred, which recover a panic and attempt to log a K8s termination message.
func Must ¶
Must panics if |err| is non-nil, supplying |msg| and |extra| as formatter and fields of the generated panic.
func MustParseArgs ¶
func MustParseArgs(parser *flags.Parser)
MustParseArgs requires that Parser be able to ParseArgs without error.
func MustParseConfig ¶
func MustParseConfig(parser *flags.Parser, configName string)
MustParseConfig requires that the Parser parse from the combination of an optional INI file, configured environment bindings, and explicit flags. An INI file matching |configName| is searched for in:
- The current working directory.
- ~/.config/gazette (under the users's $HOME or %UserProfile% directory).
- $APPLICATION_CONFIG_ROOT
Types ¶
type AddCommandFunc ¶ added in v0.99.0
type AddCommandFunc func(*flags.Command) error
AddCommandFunc are used to register sub-commands with a parent
type AddressConfig ¶
type AddressConfig struct { Address pb.Endpoint `long:"address" env:"ADDRESS" default:"http://localhost:8080" description:"Service address endpoint"` CertFile string `long:"cert-file" env:"CERT_FILE" default:"" description:"Path to the client TLS certificate"` CertKeyFile string `long:"cert-key-file" env:"CERT_KEY_FILE" default:"" description:"Path to the client TLS private key"` TrustedCAFile string `` /* 139-byte string literal not displayed */ AuthKeys string `` /* 159-byte string literal not displayed */ }
AddressConfig of a remote service.
func (*AddressConfig) MustDial ¶
func (c *AddressConfig) MustDial(ctx context.Context) *grpc.ClientConn
MustDial dials the server address using a protocol.Dispatcher balancer, and panics on error.
func (*AddressConfig) MustJournalClient ¶
func (c *AddressConfig) MustJournalClient(ctx context.Context) pb.JournalClient
MustJournalClient dials and returns a new JournalClient.
func (*AddressConfig) MustShardClient ¶
func (c *AddressConfig) MustShardClient(ctx context.Context) pc.ShardClient
MustShardClient dials and returns a new ShardClient.
type ClientConfig ¶
type ClientConfig struct { AddressConfig Cache struct { Size int `` /* 141-byte string literal not displayed */ TTL time.Duration `long:"cache.ttl" env:"CACHE_TTL" default:"1m" description:"Time-to-live of route cache entries."` } }
ClientConfig configures the client of a remote Gazette service.
func (*ClientConfig) BuildRouter ¶
func (c *ClientConfig) BuildRouter() pb.DispatchRouter
BuildRouter returns a configured DispatchRouter.
func (*ClientConfig) MustRoutedJournalClient ¶
func (c *ClientConfig) MustRoutedJournalClient(ctx context.Context) pb.RoutedJournalClient
MustRoutedJournalClient composes MustDial and BuildRouter to return a RoutedJournalClient.
func (*ClientConfig) MustRoutedShardClient ¶
func (c *ClientConfig) MustRoutedShardClient(ctx context.Context) pc.RoutedShardClient
MustRoutedShardClient composes MustDial and BuildRouter to return a RoutedShardClient.
type CommandRegistry ¶ added in v0.99.0
type CommandRegistry map[string][]AddCommandFunc
CommandRegistry is a simple tool for building a tree of github.com/jessevdk/go-flags.AddCommand functions that you can use to register sub-commands under a github.com/jessevdk/go-flags.Command
func NewCommandRegistry ¶ added in v0.99.0
func NewCommandRegistry() CommandRegistry
NewCommandRegistry creates a new registry
func (CommandRegistry) AddCommand ¶ added in v0.99.0
func (cr CommandRegistry) AddCommand(parentName string, command string, shortDescription string, longDescription string, data interface{})
AddCommand takes a parentName and then an github.com/jessevdk/go-flags.AddCommand specification and stores it in the registry You can specify a tree of commands by separating parentName with dots. Example for adding command level1 and then level1 level2
AddCommand("level1",....) AddCommand("level1.level2",....)
func (CommandRegistry) AddCommands ¶ added in v0.99.0
func (cr CommandRegistry) AddCommands(rootName string, rootCmd *flags.Command, recursive bool) error
AddCommands recursively walks through the tree of registered sub-commands under rootName and adds them under rootCmd. If recursive is true it will recurse down the tree to add sub-commands of sub-commands
type DiagnosticsConfig ¶
type DiagnosticsConfig struct { }
DiagnosticsConfig configures pull-based application metrics, debugging and diagnostics.
type EtcdConfig ¶
type EtcdConfig struct { Address protocol.Endpoint `long:"address" env:"ADDRESS" default:"http://localhost:2379" description:"Etcd service address endpoint"` CertFile string `long:"cert-file" env:"CERT_FILE" default:"" description:"Path to the client TLS certificate"` CertKeyFile string `long:"cert-key-file" env:"CERT_KEY_FILE" default:"" description:"Path to the client TLS private key"` TrustedCAFile string `` /* 139-byte string literal not displayed */ LeaseTTL time.Duration `long:"lease" env:"LEASE_TTL" default:"20s" description:"Time-to-live of Etcd lease"` }
EtcdConfig configures the application Etcd session.
func (*EtcdConfig) MustDial ¶
func (c *EtcdConfig) MustDial() *clientv3.Client
MustDial builds an Etcd client connection.
type LogConfig ¶
type LogConfig struct { Level string `` /* 155-byte string literal not displayed */ Format string `long:"format" env:"FORMAT" default:"text" choice:"json" choice:"text" choice:"color" description:"Logging output format"` }
LogConfig configures handling of application log events.
type ServiceConfig ¶
type ServiceConfig struct { ZoneConfig ID string `long:"id" env:"ID" description:"Unique ID of this process. Auto-generated if not set"` Host string `long:"host" env:"HOST" description:"Addressable, advertised hostname or IP of this process. Hostname is used if not set"` Port string `` /* 192-byte string literal not displayed */ ServerCertFile string `` /* 195-byte string literal not displayed */ ServerCertKeyFile string `long:"server-cert-key-file" env:"SERVER_CERT_KEY_FILE" default:"" description:"Path to the server TLS private key"` ServerCAFile string `` /* 323-byte string literal not displayed */ PeerCertFile string `` /* 128-byte string literal not displayed */ PeerCertKeyFile string `` /* 136-byte string literal not displayed */ PeerCAFile string `` /* 188-byte string literal not displayed */ MaxGRPCRecvSize uint32 `` /* 146-byte string literal not displayed */ AllowOrigin []string `long:"allow-origin" env:"ALLOW_ORIGIN" description:"Origin to allow in CORS contexts"` }
ServiceConfig represents identification and addressing configuration of the process.
func (ServiceConfig) BuildProcessSpec ¶ added in v0.84.1
func (cfg ServiceConfig) BuildProcessSpec(srv *server.Server) protocol.ProcessSpec
ProcessSpec of the ServiceConfig.
func (ServiceConfig) CORSWrapper ¶ added in v0.100.0
func (cfg ServiceConfig) CORSWrapper(wrapped http.Handler) http.Handler
type ZoneConfig ¶
type ZoneConfig struct {
Zone string `long:"zone" env:"ZONE" default:"local" description:"Availability zone within which this process is running"`
}
ZoneConfig configures the zone of the application.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package runconsumer extends consumer.Application with support for configuration and application initialization.
|
Package runconsumer extends consumer.Application with support for configuration and application initialization. |