app

package
v0.23.0-rc1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package app contains base application constants, flags and options.

Index

Constants

View Source
const (
	NamespaceEnv           = "NAMESPACE"
	LoggerLevelEnv         = "LOGGER_LEVEL"
	LoggerCollectorAddrEnv = "LOGGER_COLLECTOR_ADDR"
	LoggerDisableStdoutEnv = "LOGGER_DISABLE_STDOUT"
	JaegerAddrEnv          = "JAEGER_ADDR"
	JaegerSamplerType      = "JAEGER_SAMPLER_TYPE"
	JaegerSamplerParam     = "JAEGER_SAMPLER_PARAM"
	HTTPPortEnv            = "SERVICE_PORT_HTTP"
	GRPCPortEnv            = "SERVICE_PORT_GRPC"
	AdminPortEnv           = "SERVICE_PORT_ADMIN"
)

Application internal config keys.

View Source
const (
	DeploymentsDir  = ".deploy"
	ValuesDir       = "config"
	ValuesExt       = "yaml"
	ValuesBaseName  = "values"
	ValuesDevName   = "values_dev"
	ValuesLocalName = "values_local"
	ValuesStgName   = "values_stage"
	ValuesProdName  = "values_prod"
)

Default names for application files and directories.

Variables

View Source
var (
	InstanceUUID = uuid.New()
	StartTime    = time.Now()
	ServiceName  = "-"
	AppName      = "-"
	GitHash      = "-"
	Version      = "-"
	BuildAt      = "0001-01-01T00:00:00"
)

nolint:gochecknoglobals // build args

Functions

This section is empty.

Types

type Info added in v0.2.0

type Info struct {
	InstanceUUID string
	ServiceName  string
	Namespace    string
	AppName      string
	GitHash      string
	Version      string
	BuildAt      string
	StartTime    time.Time
}

Info contains service information.

type Namespace

type Namespace string

Namespace type.

const (
	NamespaceDev   Namespace = "dev"
	NamespaceLocal Namespace = "local"
	NamespaceStage Namespace = "stage"
	NamespaceProd  Namespace = "prod"
)

Namespace values.

func ParseNamespace

func ParseNamespace(s string) Namespace

ParseNamespace return app Namespace.

func (Namespace) String

func (n Namespace) String() string

func (Namespace) ValuesName added in v0.8.0

func (n Namespace) ValuesName() string

ValuesName returns config values name for current namespace.

type Option

type Option func(opts *Options) error

Option sets tron options such as ports, config, etc.

type Options

type Options struct {
	// New options.
	Hostname       string
	PortAdmin      uint16
	PortHTTP       uint16
	PortGRPC       uint16
	RealtimeConfig bool
	LoggerOptions  []zaplog.Option
	ExitSignals    []os.Signal
	ConfigMap      map[string]interface{}
	GRPCListener   net.Listener
	HTTPListener   net.Listener

	// Run options.
	TLSConfig   *tls.Config
	GRPCOptions []grpc.ServerOption
	// contains filtered or unexported fields
}

Options is base tron options.

func NewOptions

func NewOptions(options ...Option) (*Options, error)

NewOptions returns Options with applied Option list.

func (*Options) AddRunOptions added in v0.2.0

func (o *Options) AddRunOptions(options ...RunOption)

AddRunOptions append run options to others options.

func (*Options) ApplyRunOptions

func (o *Options) ApplyRunOptions() error

ApplyRunOptions sets run options.

type RunOption

type RunOption func(opts *Options) error

RunOption sets tron run options such as grpc unary interceptors, tls config.

Jump to

Keyboard shortcuts

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