MCPcopy Create free account
hub / github.com/astercloud/aster / LoadFromString

Method LoadFromString

pkg/config/loader.go:111–121  ·  view source on GitHub ↗

LoadFromString 从字符串加载配置

(content string, v any)

Source from the content-addressed store, hash-verified

109
110// LoadFromString 从字符串加载配置
111func (l *Loader) LoadFromString(content string, v any) error {
112 if l.expandEnv {
113 content = l.expandVariables(content)
114 }
115
116 if err := yaml.Unmarshal([]byte(content), v); err != nil {
117 return fmt.Errorf("parse yaml: %w", err)
118 }
119
120 return nil
121}
122
123// expandVariables 展开变量
124// 支持的格式:

Callers 1

TestLoadFromStringFunction · 0.95

Implementers 1

Managerpkg/memory/rules/manager.go

Calls 1

expandVariablesMethod · 0.95

Tested by 1

TestLoadFromStringFunction · 0.76