1
0
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:
handlerug 2021-04-28 17:40:53 +07:00
parent df9e059e69
commit 9f8003e8c9
No known key found for this signature in database
GPG Key ID: 38009F0605051491

View File

@ -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)
} }