Monibuca / engine

Monibuca 核心引擎,包含流媒体核心转发逻辑,需要配合功能插件一起组合运行
MIT License
937 stars 199 forks source link

Config parser incorrectly ignores YAML tags in config structs #84

Closed abrar71 closed 9 months ago

abrar71 commented 1 year ago

The YAML parser in the config file is currently not respecting the yaml tag present in our custom plugin configuration struct

MyCustomOption string `yaml:"my_custom_option"`

like this ->

type MyPluginConfig struct {
  config.HTTP
  config.Publish
  config.Pull
  config.Subscribe
  config.Push
  MyCustomOption string `yaml:"my_custom_option"`
}

Technically the config parser should search for my_custom_option in the yaml config but the issue is it tries to find mycustomoption and doesn't use the yaml tag from plugin struct.

This behavior contradicts the expected usage of the yaml tag in the struct, which is meant to provide a clear mapping between the struct field and the corresponding key in the YAML configuration.

langhuihui commented 1 year ago

indeed

langhuihui commented 9 months ago

done!