Skip to content

Commit

Permalink
Merge pull request #6288 from filecoin-project/fix/config-change
Browse files Browse the repository at this point in the history
fix: use existing config
  • Loading branch information
LinZexiao authored Mar 13, 2024
2 parents 4dcd7b8 + 89538f1 commit 58abd47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ var daemonCmd = &cmds.Command{
return err
}

cfg, err := repo.LoadConfig(repoDir) //use exit config, allow user prepare config before
cfg, err := repo.LoadConfig(repoDir) // use exit config, allow user prepare config before
if err != nil {
if errors.Is(err, os.ErrNotExist) {
log.Infof("config not exist, use default config")
cfg = config.NewDefaultConfig()
} else {
return err
Expand Down
2 changes: 2 additions & 0 deletions pkg/repo/fsrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func InitFSRepoDirect(targetPath string, version uint, cfg *config.Config) error
if err := initConfig(repoPath, cfg); err != nil {
return errors.Wrap(err, "initializing config file failed")
}

if err := initDataTransfer(repoPath); err != nil {
return errors.Wrap(err, "initializing data-transfer directory failed")
}
Expand Down Expand Up @@ -479,6 +480,7 @@ func initConfig(p string, cfg *config.Config) error {
return errors.Wrap(err, "error inspecting config file")
} else if exists {
//config file prepared before
Config = cfg
return nil
}

Expand Down

0 comments on commit 58abd47

Please sign in to comment.