runtime

package
v4.0.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyRegistry   = "registry"
	KeyBroker     = "broker"
	KeyConfig     = "config"
	KeyFork       = "fork"
	KeyForkLegacy = "is_fork"
	KeyArgTags    = "tags"
	KeyArgExclude = "exclude"

	KeyAdvertiseAddress = "advertise_address"
	KeyBindHost         = "bind_address"
	KeyGrpcPort         = "grpc_port"
	KeyHttpPort         = "http_port"
	KeyGrpcExternal     = "grpc_external"
	KeyHealthCheckPort  = "healthcheck"
	KeyRegistryPort     = "port_registry"
	KeyBrokerPort       = "port_broker"

	KeySiteBind               = "bind"
	KeySiteExternal           = "external"
	KeySiteNoTLS              = "no_tls"
	KeySiteTlsCertFile        = "tls_cert_file"
	KeySiteTlsKeyFile         = "tls_key_file"
	KeySiteLetsEncryptEmail   = "le_email"
	KeySiteLetsEncryptAgree   = "le_agree"
	KeySiteLetsEncryptStaging = "le_staging"

	KeyInstallCli       = "install_cli"
	KeyInstallYaml      = "install_yaml"
	KeyInstallJson      = "install_json"
	KeyInstallExitAfter = "exit_after_install"

	KeyInstallCliLegacy  = "cli"
	KeyInstallYamlLegacy = "yaml"
	KeyInstallJsonLegacy = "json"

	KeyLog       = "log"
	KeyLogJson   = "log_json"
	KeyLogToFile = "log_to_file"

	KeyEnableMetrics = "enable_metrics"
	KeyEnablePprof   = "enable_pprof"

	KeyHttpServer    = "http"
	HttpServerCaddy  = "caddy"
	HttpServerNative = "http"
)

Variables

This section is empty.

Functions

func BrokerURL

func BrokerURL() string

BrokerURL returns the scheme://address url for Broker

func BuildForkParams

func BuildForkParams(cmd string) []string

BuildForkParams creates --key=value arguments from runtime parameters

func ConfigURL

func ConfigURL() string

ConfigURL returns the scheme://address url for Config

func DefaultAdvertiseAddress

func DefaultAdvertiseAddress() string

DefaultAdvertiseAddress reads or compute the advertise address

func ForkContext

func ForkContext(ctx, parent context.Context) context.Context

ForkContext copies all necessary dependencies using the internal ContextInjector registry

func GetBool

func GetBool(key string) bool

GetBool gets a key as boolean from global runtime

func GetString

func GetString(key string) string

GetStrsing gets a key from global runtime

func GetStringSlice

func GetStringSlice(key string) []string

GetStringSlice gets a slice from global runtime.

func GrpcBindAddress

func GrpcBindAddress() string

GrpcBindAddress returns the KeyBindHost:KeyGrpcPort URL

func GrpcExternalPort

func GrpcExternalPort() string

GrpcExternalPort returns optional GRPC port to be used for external binding

func HttpBindAddress

func HttpBindAddress() string

HttpBindAddress returns the KeyBindHost:KeyHttpPort URL

func HttpServerType

func HttpServerType() string

HttpServerType returns one of HttpServerCaddy or HttpServerCore

func Init

func Init(ctx context.Context, typ string)

func InitGlobalConnConsumers

func InitGlobalConnConsumers(ctx context.Context, typ string)

func IsFork

func IsFork() bool

IsFork checks if the runtime is originally a fork of a different process

func IsLocal

func IsLocal() bool

IsLocal check if the environment runtime config is generated locally

func IsRemote

func IsRemote() bool

IsRemote check if the environment runtime config is a remote server

func IsRequired

func IsRequired(name string, tags ...string) bool

IsRequired checks arguments, --tags and --exclude against a service name

func IsSet

func IsSet(key string) bool

IsSet check existence of a key in runtime

func LogJSON

func LogJSON() bool

LogJSON returns the --log_json value

func LogLevel

func LogLevel() string

LogLevel returns the --log value

func LogToFile

func LogToFile() bool

LogToFile returns the --log_to_file value

func MetricsEnabled

func MetricsEnabled() bool

MetricsEnable returns if the metrics should be published or not

func PprofEnabled

func PprofEnabled() bool

PprofEnabled returns if an http endpoint should be published for debug/pprof

func ProcessStartTags

func ProcessStartTags() []string

ProcessStartTags returns a list of tags to be used for identifying processes

func Register

func Register(typ string, y ...func(ctx context.Context))

func RegisterContextInjector

func RegisterContextInjector(injector ContextInjector)

RegisterContextInjector appends a ContextInjector to the internal registry

func RegisterGlobalConnConsumer

func RegisterGlobalConnConsumer(typ string, y ...func(ctx context.Context))

func RegistryURL

func RegistryURL() string

RegistryURL returns the scheme://address url for Registry

func SetArgs

func SetArgs(aa []string)

SetArgs copies command arguments to internal value

func SetDefault

func SetDefault(key string, value interface{})

SetDefault updates global runtime

func SetRuntime

func SetRuntime(runtime Runtime)

SetRuntime sets internal global Runtime

Types

type ContextInjector

type ContextInjector func(ctx, parent context.Context) context.Context

type Runtime

type Runtime interface {
	GetBool(key string) bool
	GetString(key string) string
	GetStringSlice(key string) []string
	IsSet(key string) bool
	SetDefault(key string, value interface{})
}

Jump to

Keyboard shortcuts

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