mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-24 11:57:44 +08:00
fix(repo/config) detect strings that represent ints
This commit is contained in:
parent
bbc9715d4b
commit
bbcbf46ce7
@ -1,6 +1,8 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
common "github.com/jbenet/go-ipfs/repo/common"
|
||||
config "github.com/jbenet/go-ipfs/repo/config"
|
||||
serialize "github.com/jbenet/go-ipfs/repo/fsrepo/serialize"
|
||||
@ -86,6 +88,12 @@ func (c *ConfigComponent) SetConfigKey(key string, value interface{}) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
if i, err := strconv.Atoi(v); err == nil {
|
||||
value = i
|
||||
}
|
||||
}
|
||||
var mapconf map[string]interface{}
|
||||
if err := serialize.ReadConfigFile(filename, &mapconf); err != nil {
|
||||
return err
|
||||
|
||||
Loading…
Reference in New Issue
Block a user