Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
Do not fail when no config file is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
jmattheis committed Dec 7, 2018
1 parent dbba395 commit e04eb7d
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions configor.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ func New(config *Config) *Configor {
return &Configor{Config: config}
}

var (
// ErrNoConfigFiles is returned by Load when no files from the given list
// could be found.
ErrNoConfigFiles = errors.New("could not find any configuration files")
)

// Load will decode the given files into `config` using default settings.
func Load(config interface{}, files ...string) (err error) {
return New(nil).Load(config, files...)
Expand All @@ -48,9 +42,6 @@ func Load(config interface{}, files ...string) (err error) {
// Load will decode the given files into `config`
func (configor *Configor) Load(config interface{}, files ...string) (err error) {
configFiles := configor.getConfigurationFiles(files...)
if len(configFiles) == 0 {
return ErrNoConfigFiles
}

for _, file := range configFiles {
if err := UnmarshalFile(config, file, configor.ErrorOnUnmatchedKeys); err != nil {
Expand Down

0 comments on commit e04eb7d

Please sign in to comment.