Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
Load environment variables from `os env`, `.env` file and pass it to struct.
For local development use `.env` file from root project.
Load also call a `Validate` method.
Example:
var config internalConfig.Config
if err := cfg.Load(&config); err != nil {
log.Fatalf("could not load configuration: %v", err)
}
func LoadForTests ¶ added in v0.0.10
LoadForTests environment variables from `os env`, `.env` file and pass it to struct for tests.
Disabled flags detection and any cli features.
For local development use `.env` file from root project.
LoadForTests also call a `Validate` method.
Example:
var config internalConfig.Config
if err := cfg.Load(&config); err != nil {
log.Fatalf("could not load configuration: %v", err)
}
Types ¶
type Option ¶
type Option func(*options)
func WithContext ¶
func WithEnvFile ¶
func WithEnvPath ¶
func WithValidate ¶
func WithValidateFuncs ¶
func WithValidateFuncs(items ...ValidateFn) Option
func WithVersion ¶
Click to show internal directories.
Click to hide internal directories.