ParseFile 第四步读取用户配置文件
(conf map[string]any)
| 214 | |
| 215 | // ParseFile 第四步读取用户配置文件 |
| 216 | func (config *Config) ParseUserFile(conf map[string]any) { |
| 217 | if conf == nil { |
| 218 | return |
| 219 | } |
| 220 | config.File = conf |
| 221 | for k, v := range conf { |
| 222 | if config.Has(k) { |
| 223 | if prop := config.Get(k); prop.props != nil { |
| 224 | if v != nil { |
| 225 | prop.ParseUserFile(v.(map[string]any)) |
| 226 | } |
| 227 | } else { |
| 228 | fv := prop.assign(k, v) |
| 229 | prop.File = fv.Interface() |
| 230 | if prop.Env == nil { |
| 231 | prop.Ptr.Set(fv) |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | // ParseModifyFile 第五步读取动态修改配置文件 |
| 239 | func (config *Config) ParseModifyFile(conf map[string]any) { |