Documentation
¶
Index ¶
- func ForceParse(structPointer any)
- func ForceParseByKey(key string, structPointer any)
- func Init(opts ...ConfigOption) error
- func Parse(structPointer any) error
- func ParseByKey(key string, structPointer any) error
- type Config
- type ConfigFile
- type ConfigOption
- type EnvironmentConfig
- type EnvironmentType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForceParse ¶
func ForceParse(structPointer any)
func ForceParseByKey ¶
func Init ¶
func Init(opts ...ConfigOption) error
func ParseByKey ¶
Types ¶
type Config ¶
type Config struct {
Environment EnvironmentType
ConfigFile ConfigFile
AutoParseEnv bool
// WeakMatchName ignore difference between camelCase, snake_case, etc.
WeakMatchName bool
// use github.com/creasty/defaults
InitWithDefault bool
// use github.com/go-playground/validator
ValidAfterParse bool
}
type ConfigFile ¶
type ConfigOption ¶
type ConfigOption func(*Config)
type EnvironmentConfig ¶
type EnvironmentConfig struct {
Environment EnvironmentType `env:"ENVIRONMENT" envDefault:"TEST"`
}
type EnvironmentType ¶
type EnvironmentType string
const ( Debug EnvironmentType = "DEBUG" Test EnvironmentType = "TEST" Prod EnvironmentType = "PROD" )
func Environment ¶
func Environment() EnvironmentType
Click to show internal directories.
Click to hide internal directories.