Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
EmptyAppNameError = errors.New("appName is empty")
)
View Source
var (
InvalidLogOutputConfigErr = errors.New("invalid log output configuration: should enable stdout or define an output file")
)
Functions ¶
func InitSetup ¶
func InitSetup(appName string, opts ...OptionFunc) error
InitSetup sets up application default configurations for spf13/viper and slog libraries
Types ¶
type OptionFunc ¶
type OptionFunc func(*Options)
OptionFunc customization option
func WithConfigFileToBeUsed ¶
func WithConfigFileToBeUsed(file string) OptionFunc
WithConfigFileToBeUsed defines the app configuration file to be used
func WithDefaultCfgFileLocations ¶
func WithDefaultCfgFileLocations(f ...string) OptionFunc
WithDefaultCfgFileLocations defines locations to search for config files
func WithDefaultCfgFileName ¶
func WithDefaultCfgFileName(f string) OptionFunc
WithDefaultCfgFileName defines default config file name
func WithDefaultValues ¶
func WithDefaultValues(vals map[string]any) OptionFunc
WithDefaultValues adds default values to Viper configuration
Default configuration keys:
- Logs configuration
- Log level:
- Log format: `log.format` (accepts `text` or `json`)
- Log level: `log.level` (accepts `info`, `debug`, `warn` or `error`)
- Log output file: `log.output_to_file` (output file path as a string)
- Log to stdout: `log.output_to_stdout` (accepts `true` or `false`)
type Options ¶ added in v0.0.8
type Options struct { CfgFilePathToBeUsed string DefaultCfgFileLocations []string DefaultCfgFileName string DefaultValues map[string]any }
func (*Options) GetDefaultCfgFileLocations ¶ added in v0.0.8
func (*Options) GetDefaultCfgFileName ¶ added in v0.0.8
func (*Options) GetDefaultValues ¶ added in v0.0.8
Click to show internal directories.
Click to hide internal directories.