mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-10 09:52:20 +08:00
refactor(init): write config at top level
This commit is contained in:
@ -104,11 +104,15 @@ func doInit(configRoot string, dspathOverride string, force bool, nBitsForKeypai
|
||||
return nil, errCannotInitConfigExists
|
||||
}
|
||||
|
||||
conf, err := initConfig(configFilename, dspathOverride, nBitsForKeypair)
|
||||
conf, err := initConfig(dspathOverride, nBitsForKeypair)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := config.WriteConfigFile(configFilename, conf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = addTheWelcomeFile(conf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -165,7 +169,7 @@ func datastoreConfig(dspath string) (config.Datastore, error) {
|
||||
return ds, nil
|
||||
}
|
||||
|
||||
func initConfig(configFilename string, dspathOverride string, nBitsForKeypair int) (*config.Config, error) {
|
||||
func initConfig(dspathOverride string, nBitsForKeypair int) (*config.Config, error) {
|
||||
ds, err := datastoreConfig(dspathOverride)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -214,10 +218,6 @@ func initConfig(configFilename string, dspathOverride string, nBitsForKeypair in
|
||||
Version: config.VersionDefaultValue(),
|
||||
}
|
||||
|
||||
if err := config.WriteConfigFile(configFilename, conf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return conf, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user