goapp

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: BSD-3-Clause Imports: 17 Imported by: 35

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = viper.New()

Config is a viper based application config

View Source
var Log = log.Logger

Log is applications logger

Functions

func Estimate added in v0.2.1

func Estimate(name string) func()

Estimate estimates and logs execution duration sample: defer goapp.Estimate("function")()

func HidePass added in v0.2.0

func HidePass(link string) string

HidePass removes pass from URL

func InitConfig

func InitConfig(configFile string) error

InitConfig tries to load config.yml from exe's dir

func InitEnv

func InitEnv(config *viper.Viper)

InitEnv initializes viper for environment variables

func InvokeWithBackoff added in v1.0.25

func InvokeWithBackoff[K any](ctx context.Context, f func() (K, bool, error), b backoff.BackOff) (K, error)

InvokeWithBackoff func with backoff

func IsRetryableCode added in v1.0.25

func IsRetryableCode(c int) bool

IsRetryableCode returns true if status is a retryable HTTP code

func IsRetryableErr added in v1.0.25

func IsRetryableErr(err error) bool

IsRetryableErr check if err may be retryable

func Sanitize added in v0.4.21

func Sanitize(str string) string

Sanitize replaces new lines in str for logging

func StartWithDefault

func StartWithDefault()

StartWithDefault default app initialization function Tries to load config from commandline option '-c' panics on error

func StartWithFlags

func StartWithFlags(fs *flag.FlagSet, args []string)

StartWithFlags app initialization function with flagset panics on error

func Sub

func Sub(config *viper.Viper, name string) *viper.Viper

Sub extracts Sub config from viper using env variables

func ValidateHTTPResp added in v0.3.0

func ValidateHTTPResp(resp *http.Response, bodyLen int) error

ValidateHTTPResp returns error if code is not in [200, 299] bodyLen - size of bytes to try read body

Types

This section is empty.

Jump to

Keyboard shortcuts

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