config

package
v1.2.36 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Unlicense Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnv

func GetEnv() (requested bo)

func HelpRequested

func HelpRequested() (help bo)

HelpRequested returns true if any of the common types of help invocation are found as the first command line parameter/flag.

func PrintEnv

func PrintEnv(cfg *C, printer io.Writer)

func PrintHelp

func PrintHelp(cfg *C, printer io.Writer)

PrintHelp outputs a help text listing the configuration options and default values to a provided io.Writer (usually os.Stderr or os.Stdout).

Types

type C

type C struct {
	AppName      st   `env:"APP_NAME" default:"realy"`
	Profile      st   `env:"PROFILE" usage:"root path for all other path configurations (based on APP_NAME and OS specific location)"`
	Listen       st   `env:"LISTEN" default:"0.0.0.0" usage:"network listen address"`
	Port         no   `env:"PORT" default:"3334" usage:"port to listen on"`
	AdminUser    st   `env:"ADMIN_USER" default:"admin" usage:"admin user"`
	AdminPass    st   `env:"ADMIN_PASS" usage:"admin password"`
	LogLevel     st   `env:"LOG_LEVEL" default:"info" usage:"debug level: fatal error warn info debug trace"`
	DbLogLevel   st   `env:"DB_LOG_LEVEL" default:"info" usage:"debug level: fatal error warn info debug trace"`
	AuthRequired bo   `env:"AUTH_REQUIRED" default:"false" usage:"requires auth for all access"`
	Owners       []st `` /* 239-byte string literal not displayed */
	DBSizeLimit  no   `` /* 149-byte string literal not displayed */
	DBLowWater   no   `env:"DB_LOW_WATER" default:"60" usage:"the percentage of DBSizeLimit a GC run will reduce the used storage down to"`
	DBHighWater  no   `env:"DB_HIGH_WATER" default:"80" usage:"the trigger point at which a GC run should start if exceeded"`
	GCFrequency  no   `env:"GC_FREQUENCY" default:"3600" usage:"the frequency of checks of the current utilisation in minutes"`
	Pprof        bo   `env:"PPROF" default:"false" usage:"enable pprof on 127.0.0.1:6060"`
	MemLimit     no   `env:"MEMLIMIT" default:"250000000" usage:"set memory limit, default is 250Mb"`
}

func New

func New() (cfg *C, err er)

type KV added in v1.2.34

type KV struct{ Key, Value st }

type KVSlice added in v1.2.34

type KVSlice []KV

func EnvKV added in v1.2.34

func EnvKV(cfg any) (m KVSlice)

EnvKV turns a struct with `env` keys (used with go-simpler/env) into a standard formatted environment variable key/value pair list, one per line. Note you must dereference a pointer type to use this. This allows the composition of the config in this file with an extended form with a customized variant of realy to produce correct environment variables both read and write.

func (KVSlice) Composit added in v1.2.34

func (kv KVSlice) Composit(kv2 KVSlice) (out KVSlice)

Composit merges two KVSlice together, replacing the values of earlier keys with same named KV items later in the slice (enabling compositing two together as a .env, as well as them being composed as structs.

func (KVSlice) Len added in v1.2.36

func (kv KVSlice) Len() int

func (KVSlice) Less added in v1.2.36

func (kv KVSlice) Less(i, j int) bool

func (KVSlice) Swap added in v1.2.36

func (kv KVSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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