MCPcopy
hub / github.com/cubefs/cubefs / LoadConfigString

Function LoadConfigString

util/config/config.go:61–70  ·  view source on GitHub ↗

LoadConfigString loads config information from a JSON string.

(s string)

Source from the content-addressed store, hash-verified

59
60// LoadConfigString loads config information from a JSON string.
61func LoadConfigString(s string) *Config {
62 result := newConfig()
63 decoder := json.NewDecoder(strings.NewReader(s))
64 decoder.UseNumber()
65 err := decoder.Decode(&result.data)
66 if err != nil {
67 log.Fatalf("error parsing config string %s: %s", s, err)
68 }
69 return result
70}
71
72func (c *Config) parse(fileName string) error {
73 jsonFileBytes, err := os.ReadFile(fileName)

Callers 3

initFunction · 0.92
createMasterServerFunction · 0.92
testConfigFunction · 0.92

Calls 4

DecodeMethod · 0.95
NewReaderMethod · 0.80
newConfigFunction · 0.70
FatalfMethod · 0.65

Tested by 3

initFunction · 0.74
createMasterServerFunction · 0.74
testConfigFunction · 0.74