config

package
v0.0.0-...-4263410 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Application   = &config.App
	Stats         = &config.Stats
	Reservation   = &config.Reservation
	Database      = &config.Database
	Prometheus    = &config.Prometheus
	Logging       = &config.Logging
	Telemetry     = &config.Telemetry
	Cloudwatch    = &config.Cloudwatch
	AWS           = &config.AWS
	Azure         = &config.Azure
	GCP           = &config.GCP
	RestEndpoints = &config.RestEndpoints
	ImageBuilder  = &config.RestEndpoints.ImageBuilder
	Sources       = &config.RestEndpoints.Sources
	RBAC          = &config.RestEndpoints.RBAC
	Worker        = &config.Worker
	Unleash       = &config.Unleash
	Sentry        = &config.Sentry
	Kafka         = &config.Kafka
)

Config shortcuts

View Source
var (
	ErrValidateMissingSecret = errors.New("config error: Cloudwatch enabled but Region or Key or Secret are blank")
	ErrValidateGroupStream   = errors.New("config error: Cloudwatch enabled but Group or Stream is blank")
)

Errors

Functions

func BinaryName

func BinaryName() string

func DumpClowder

func DumpClowder(logger zerolog.Logger)

DumpClowder writes safely some information from clowder config.

func DumpConfig

func DumpConfig(logger zerolog.Logger)

DumpConfig writes configuration to a logger. It removes all secrets, however, it is never recommended to call this function in production environments.

func Environment

func Environment() string

Environment returns clowder environment (stage, prod or ephemeral) or "dev" in case the app is not running in Clowder.

func EnvironmentPrefix

func EnvironmentPrefix(prefix, identifier string) string

EnvironmentPrefix wraps an identifier (e.g. id, unique id) in the following way. For production environment, it returns "prefix-identifier". For any other environment, it returns "prefix-identifier-env". Examples:

* reservation-14572 * reservation-9531-stage * reservation-13-ephemeral * reservation-1-dev

func FeatureEnabled

func FeatureEnabled(ctx context.Context, name string) bool

FeatureEnabled returns a user-specific or global feature flag. When such flag is not found, true is returned.

func HelpText

func HelpText() (string, error)

func Hostname

func Hostname() string

func InClowder

func InClowder() bool

IsClowder returns true, when the app is running in clowder environment, whether it is production, stage or ephemeral.

func InEphemeralClowder

func InEphemeralClowder() bool

InEphemeralClowder returns true, when the app is running in ephemeral clowder environment.

func InProdClowder

func InProdClowder() bool

InProdClowder returns true, when the app is running in production clowder environment.

func InStageClowder

func InStageClowder() bool

InStageClowder returns true, when the app is running in stage clowder environment.

func Initialize

func Initialize(configFiles ...string)

Initialize loads configuration from provided .env files, the first existing file wins.

func InitializeFeatureFlags

func InitializeFeatureFlags(ctx context.Context) error

InitializeFeatureFlags configures unleash client and starts poller routine. Callers must close poller by calling StopFeatureFlags function.

func LaunchEnabled

func LaunchEnabled(ctx context.Context) bool

LaunchEnabled: launch button in UI initiates the application workflow

func RedisHostAndPort

func RedisHostAndPort() string

func StopFeatureFlags

func StopFeatureFlags(ctx context.Context)

StopFeatureFlags stops the unleash feature flag poller

func StringToURL

func StringToURL(urlStr string) *url.URL

func TopicName

func TopicName(ctx context.Context, topic string) string

TopicName returns mapped topic from Clowder. When not running in Clowder mode, it returns the input topic name.

func UnleashContext

func UnleashContext(ctx context.Context) ucontext.Context

UnleashContext returns unleash context or an empty context when not set.

func WithUnleashContext

func WithUnleashContext(ctx context.Context, uctx ucontext.Context) context.Context

WithUnleashContext returns context copy with unleash context as a value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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