Skip to content

Commit

Permalink
load configs from project root
Browse files Browse the repository at this point in the history
  • Loading branch information
vgarvardt committed Jul 31, 2014
1 parent 087b4de commit 0bbed8b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ _testmain.go
data/*

# Ignore env config files, except for the default one
cfg/*.ini
!cfg/config.ini
*.ini
!config.ini
6 changes: 3 additions & 3 deletions cfg/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ func init() {
stdlogger = log.New(os.Stdout, "", 0)
Log(fmt.Sprintf("Loading config with env set to %s", env))

filePath := fmt.Sprintf("./cfg/%s.ini", env)
filePath := fmt.Sprintf("./%s.ini", env)
if _, err := os.Stat(filePath); os.IsNotExist(err) {
Log(fmt.Sprintf("Loading config from ./cfg/config.ini"))
reader, _ = config.ReadDefault("./cfg/config.ini")
Log(fmt.Sprintf("Loading config from ./config.ini"))
reader, _ = config.ReadDefault("./config.ini")
} else {
Log(fmt.Sprintf("Loading config from %s", filePath))
reader, _ = config.ReadDefault(filePath)
Expand Down
File renamed without changes.

0 comments on commit 0bbed8b

Please sign in to comment.