Documentation
¶
Index ¶
- func Config() *config.Store
- func DefaultConfig(v *config.Store)
- func DefaultNormalize(v *config.Store) error
- func Logger() *logger.Logger
- func SetupWithOpts(options ...Option)
- func Teardown()
- type ConfigDefaultsProvider
- type ConfigNormalizer
- type LoggerProvider
- type Option
- func DisableFlags() Option
- func DisableLogger() Option
- func WithConfigDefaultsProvider(fn ConfigDefaultsProvider) Option
- func WithConfigNormalizer(fn ConfigNormalizer) Option
- func WithConfigStore(file string, ft config.FileType, dt config.DataType, rootKeys ...string) Option
- func WithJsonConfParser(file string, obj any, normalize func(obj any) error) Optiondeprecated
- func WithLogger(l *logger.Logger) Option
- func WithLoggerProvider(provider func() *logger.Logger) Option
- func WithWorkingDir(wd *env.WorkingDir) Option
- func WithWorkingDirLayout(wd *env.WorkingDir) Option
- type Pareto
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfig ¶ added in v0.2.0
func DefaultNormalize ¶ added in v0.2.0
func SetupWithOpts ¶
func SetupWithOpts(options ...Option)
SetupWithOpts creates a pareto environment for an app with the given options.
Types ¶
type ConfigDefaultsProvider ¶ added in v0.2.0
type ConfigNormalizer ¶ added in v0.2.0
type LoggerProvider ¶ added in v0.2.0
type Option ¶
type Option func(*Pareto)
Option defines pareto initialization options.
func DisableLogger ¶ added in v0.2.0
func DisableLogger() Option
func WithConfigDefaultsProvider ¶ added in v0.2.0
func WithConfigDefaultsProvider(fn ConfigDefaultsProvider) Option
func WithConfigNormalizer ¶ added in v0.2.0
func WithConfigNormalizer(fn ConfigNormalizer) Option
WithConfigNormalizer provides a config normalizer function which will be called when the config, if exists, is loaded.
func WithConfigStore ¶ added in v0.2.0
func WithConfigStore(file string, ft config.FileType, dt config.DataType, rootKeys ...string) Option
WithConfigStore specifies a config file to load, which will overwrite the default pareto config store.
func WithJsonConfParser
deprecated
WithJsonConfParser loads the json config file and invokes the normalize function.
Deprecated: WithJsonConfParser accepts json format config file only, and is outdated. Use WithConfigDefaultsProvider, WithConfigNormalizer and WithConfigStore instead.
func WithLogger ¶
WithLogger allows to provide a logger config as an option.
func WithLoggerProvider ¶
WithLoggerProvider allows to provide a logger create function.
func WithWorkingDir ¶
func WithWorkingDir(wd *env.WorkingDir) Option
WithWorkingDir acts the same as WithWorkingDirLayout except that it also set system level working dir, using os.Chdir, to the parent directory of this executable.
func WithWorkingDirLayout ¶
func WithWorkingDirLayout(wd *env.WorkingDir) Option
WithWorkingDirLayout allows to hint working dir layout.