Commit db4083f1 authored by vicotor's avatar vicotor

fix bug

parent dd650af2
...@@ -5,6 +5,8 @@ import ( ...@@ -5,6 +5,8 @@ import (
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/spf13/viper" "github.com/spf13/viper"
"os"
"path/filepath"
"reflect" "reflect"
"strings" "strings"
) )
...@@ -45,6 +47,16 @@ type LogConfig struct { ...@@ -45,6 +47,16 @@ type LogConfig struct {
var Global *Config var Global *Config
func InitConfig(cfgFile string) error { func InitConfig(cfgFile string) error {
exePath, err := os.Executable()
if err != nil {
fmt.Println("Error:", err)
return err
}
log.Warn("execute file is :", exePath)
exeDir := filepath.Dir(exePath)
os.Chdir(exeDir)
setDefaultConfig() setDefaultConfig()
if cfgFile != "" { if cfgFile != "" {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment