Documentation
¶
Index ¶
- func CreateConfig(opts ConfigOptions) (*viper.Viper, error)
- type Config
- func (c *Config) Bind(instance any) error
- func (c *Config) BindWithDefaults(instance any) error
- func (c *Config) Export(path string) error
- func (c *Config) Get(key string) any
- func (c *Config) Restore() error
- func (c *Config) RestoreFrom(snapshot map[string]any) error
- func (c *Config) Set(key string, value any)
- func (c *Config) Snapshot() (map[string]any, error)
- func (c *Config) Validate() error
- func (c *Config) ValidateType(instance any) error
- type ConfigInterface
- type ConfigOptions
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateConfig ¶
func CreateConfig(opts ConfigOptions) (*viper.Viper, error)
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func NewConfig ¶
func NewConfig(optsArr ...ConfigOptions) (*Config, error)
func (*Config) BindWithDefaults ¶
func (*Config) ValidateType ¶
type ConfigInterface ¶
type ConfigOptions ¶
type ConfigOptions struct {
BasePath string
FileName string
FileType string
EnvPrefix string
WatchAble bool
OnChange func(e fsnotify.Event)
LoadAll bool
}
func DefaultConfigOptions ¶
func DefaultConfigOptions() ConfigOptions
func DevConfigOptions ¶
func DevConfigOptions() ConfigOptions
Click to show internal directories.
Click to hide internal directories.