cfg

package
v1.1.29 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package cfg - Because hardcoding values is for people who live dangerously, and we're too scared for that

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LogLevel        logger.LogLevel // How much spam you want in your logs
	LogFile         string          // Where your logs go to die
	ShutdownTimeout time.Duration   // How long before we kill it with fire
	RetryConfig     retry.Config    // For when at first you don't succeed
	EnableColors    bool            // Making logs pretty won't fix your bugs
}

Config holds all the knobs you can tweak until your application breaks

func Configure

func Configure(opts ...ConfigOption) *Config

Configure applies your questionable configuration choices Returns a Config that you'll probably need to change later anyway

func (*Config) ColorsEnabled

func (c *Config) ColorsEnabled() bool

ColorsEnabled - Are we in fancy mode?

func (*Config) GetLogLevel

func (c *Config) GetLogLevel() logger.LogLevel

GetLogLevel - In case you forgot what you configured 5 minutes ago

func (*Config) GetRetryConfig

func (c *Config) GetRetryConfig() retry.Config

GetRetryConfig - Returns your optimistic retry settings

func (*Config) GetShutdownTimeout

func (c *Config) GetShutdownTimeout() time.Duration

GetShutdownTimeout - How long until we give up and kill -9

type ConfigOption

type ConfigOption func(*Config)

ConfigOption - Because global variables are evil, but function pointers are fine

func WithColors

func WithColors(enable bool) ConfigOption

WithColors - Because monochrome logs are depressing enough already

func WithLogFile

func WithLogFile(file string) ConfigOption

WithLogFile - Because printing to stdout is so 1970s

func WithLogLevel

func WithLogLevel(level logger.LogLevel) ConfigOption

WithLogLevel - For when you want to see more (or less) of your mistakes

func WithRetryConfig

func WithRetryConfig(config retry.Config) ConfigOption

WithRetryConfig - Configure your retry strategy, as if the first attempt wasn't bad enough

func WithShutdownTimeout

func WithShutdownTimeout(timeout time.Duration) ConfigOption

WithShutdownTimeout - How patient are you really?

Jump to

Keyboard shortcuts

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