Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
func Load(opts *LoaderOpts, config Configuration) error
Load loads the configuration from the given config file.
Rules:
- The config file must be either a JSON or YAML file.
- All fields must be exported.
- Fields without env tag will be uppercase and used as environment variable name.
Types ¶
type Configuration ¶
type LoaderOpts ¶
type LoaderOpts struct {
// contains filtered or unexported fields
}
LoaderOpts
func NewLoaderOpts ¶
func NewLoaderOpts() *LoaderOpts
NewLoaderOpts returns a new LoaderOpts instance.
func (*LoaderOpts) ConfigPath ¶
func (o *LoaderOpts) ConfigPath(path string) *LoaderOpts
ConfigPath sets the path to the config file.
func (*LoaderOpts) EnvPrefix ¶
func (o *LoaderOpts) EnvPrefix(prefix string) *LoaderOpts
EnvPrefix sets the prefix for environment variables. Will capitalize the prefix.
func (*LoaderOpts) ErrorIfNotFound ¶
func (o *LoaderOpts) ErrorIfNotFound(errorIfNotFound bool) *LoaderOpts
ErrorIfNotFound sets the flag that determines whether an error should be returned if the config file is not found.
Click to show internal directories.
Click to hide internal directories.