Skip to content

Commit 33a8fa5

Browse files
mkitsdtsjyxjjj
authored andcommitted
fix(internal/conf): use flag to overwrite conf
1 parent ece1518 commit 33a8fa5

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

internal/bootstrap/config.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,17 @@ func InitConfig() {
7878
if err != nil {
7979
log.Fatalf("load config error: %+v", err)
8080
}
81+
if flags.DataDir != "" {
82+
conf.Conf.Database.DBFile = filepath.Join(flags.DataDir, "data.db")
83+
conf.Conf.TempDir = filepath.Join(flags.DataDir, "temp")
84+
conf.Conf.BleveDir = filepath.Join(flags.DataDir, "bleve")
85+
if conf.Conf.Log.Enable {
86+
conf.Conf.Log.Name = filepath.Join(flags.DataDir, "log/log.log")
87+
}
88+
if conf.Conf.DistDir != "" {
89+
conf.Conf.DistDir = filepath.Join(flags.DataDir, "dist")
90+
}
91+
}
8192
LastLaunchedVersion = conf.Conf.LastLaunchedVersion
8293
if strings.HasPrefix(conf.Version, "v") || LastLaunchedVersion == "" {
8394
conf.Conf.LastLaunchedVersion = conf.Version

0 commit comments

Comments
 (0)