Skip to content

Commit

Permalink
add default source
Browse files Browse the repository at this point in the history
  • Loading branch information
sethpollack committed Jan 9, 2025
1 parent d5c5dac commit b64e18a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions envcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,15 @@ type LoaderOption func(*loader.Loader)
func WithLoader(opts ...LoaderOption) Option {
return func(o *Options) {
l := loader.New()

for _, opt := range opts {
opt(l)
}

if len(l.Sources) == 0 {
l.Sources = []loader.Source{osenv.New()}
}

o.Loader.Sources = append(o.Loader.Sources, l)
}
}
Expand Down

0 comments on commit b64e18a

Please sign in to comment.