mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-01 06:17:56 +08:00
cmd/ipfs: Added getConfig function
This commit is contained in:
parent
cf60fdd3d9
commit
7d53e736cf
@ -43,13 +43,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
|
||||
}
|
||||
defer lk.Close()
|
||||
|
||||
configFile, err := config.Filename(configPath)
|
||||
if err != nil {
|
||||
res.SetError(err, cmds.ErrNormal)
|
||||
return
|
||||
}
|
||||
|
||||
config, err := config.Load(configFile)
|
||||
config, err := getConfig(configPath)
|
||||
if err != nil {
|
||||
res.SetError(err, cmds.ErrNormal)
|
||||
return
|
||||
|
||||
@ -149,3 +149,12 @@ func getConfigPath(req cmds.Request) (string, error) {
|
||||
}
|
||||
return configPath, nil
|
||||
}
|
||||
|
||||
func getConfig(path string) (*config.Config, error) {
|
||||
configFile, err := config.Filename(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return config.Load(configFile)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user