mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-13 05:11:21 +00:00
bring back unsafe_set_config
This commit is contained in:
@ -1,12 +1,39 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime/pprof"
|
||||
"strconv"
|
||||
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
)
|
||||
|
||||
func UnsafeSetConfig(typ, key, value string) (*ctypes.ResultUnsafeSetConfig, error) {
|
||||
switch typ {
|
||||
case "string":
|
||||
config.Set(key, value)
|
||||
case "int":
|
||||
val, err := strconv.Atoi(value)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("non-integer value found. key:%s; value:%s; err:%v", key, value, err)
|
||||
}
|
||||
config.Set(key, val)
|
||||
case "bool":
|
||||
switch value {
|
||||
case "true":
|
||||
config.Set(key, true)
|
||||
case "false":
|
||||
config.Set(key, false)
|
||||
default:
|
||||
return nil, fmt.Errorf("bool value must be true or false. got %s", value)
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("Unknown type %s", typ)
|
||||
}
|
||||
return &ctypes.ResultUnsafeSetConfig{}, nil
|
||||
}
|
||||
|
||||
var profFile *os.File
|
||||
|
||||
func UnsafeStartCPUProfiler(filename string) (*ctypes.ResultUnsafeProfile, error) {
|
||||
|
Reference in New Issue
Block a user