Skip to content

Commit

Permalink
Merge pull request #41 from aceakash/master
Browse files Browse the repository at this point in the history
CheckCompatibility mode now blows up if config file does not parse correctly
  • Loading branch information
quii committed Apr 26, 2016
2 parents 1ad7408 + c911ada commit 5564138
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion application.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ func (a *application) CheckCompatibility(configPath string, realURL string) erro
}

func (a *application) loadConfig() (endpoints []mockingjay.FakeEndpoint, err error) {

configData, err := a.configLoader(a.configPath)

if err != nil {
Expand All @@ -105,6 +104,9 @@ func (a *application) loadConfig() (endpoints []mockingjay.FakeEndpoint, err err
if newMD5 := md5.Sum(configData); newMD5 != a.yamlMD5 {
a.yamlMD5 = newMD5
endpoints, err = a.mockingjayLoader(configData)
if err != nil {
return nil, err
}
}
return
}
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ func main() {
app := defaultApplication(config.logger)

if config.realURL != "" {
app.CheckCompatibility(config.configPath, config.realURL)
err := app.CheckCompatibility(config.configPath, config.realURL)
if err != nil {
log.Fatal(err)
}
} else {
svr, err := app.CreateServer(config.configPath, config.monkeyConfigPath)

Expand Down

0 comments on commit 5564138

Please sign in to comment.