Skip to content

Commit

Permalink
Fix regression loading config file. #48
Browse files Browse the repository at this point in the history
  • Loading branch information
mofirouz committed Mar 14, 2017
1 parent 1d7e620 commit 163a540
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ The format is based on [keep a changelog](http://keepachangelog.com/) and this p
### Changed
- The build system now strips up to current dir in recorded source file paths at compile.

### Fixed
- Fix regression loading config file.

## [0.11.3] - 2017-02-25
### Added
- Add CORS headers for browser games.
Expand Down
23 changes: 12 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,22 @@ func parseArgs(clogger zap.Logger) server.Config {
var opsPort int
flags.IntVar(&opsPort, "ops-port", -1, "Set port for ops dashboard.")

if len(filepath) > 0 {
data, err := ioutil.ReadFile(filepath)
if err != nil {
clogger.Error("Could not read config file, using defaults", zap.Error(err))
} else {
err = yaml.Unmarshal([]byte(data), config)
if err := flags.Parse(os.Args[1:]); err != nil {
clogger.Error("Could not parse command line arguments - ignoring command-line overrides", zap.Error(err))
} else {

if len(filepath) > 0 {
data, err := ioutil.ReadFile(filepath)
if err != nil {
clogger.Error("Could not parse config file, using defaults", zap.Error(err))
clogger.Error("Could not read config file, using defaults", zap.Error(err))
} else {
err = yaml.Unmarshal(data, config)
if err != nil {
clogger.Error("Could not parse config file, using defaults", zap.Error(err))
}
}
}
}

if err := flags.Parse(os.Args[1:]); err != nil {
clogger.Error("Could not parse command line arguments - ignoring command-line overrides", zap.Error(err))
} else {
if len(name) > 0 {
config.Name = name
}
Expand Down

0 comments on commit 163a540

Please sign in to comment.