mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-11 21:10:26 +00:00
Absolutize the path to config file
This commit is contained in:
parent
df9e059e69
commit
9f8003e8c9
@ -2,6 +2,7 @@ package util
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/go-ini/ini"
|
"github.com/go-ini/ini"
|
||||||
@ -62,8 +63,13 @@ func ReadConfigFile(path string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if path != "" {
|
if path != "" {
|
||||||
|
path, err := filepath.Abs(path)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("cannot expand config file path: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
log.Println("Loading config at", path)
|
log.Println("Loading config at", path)
|
||||||
err := ini.MapTo(cfg, path)
|
err = ini.MapTo(cfg, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user