Make strict mode a param (#1054)

So, a wrapping config (like cloud) can skip the strict mode check.
This commit is contained in:
Raja Subramanian
2022-09-29 13:07:32 +05:30
committed by GitHub
parent c93df27329
commit 33f5dbc501
7 changed files with 13 additions and 13 deletions
+2 -2
View File
@@ -205,7 +205,7 @@ type IngressConfig struct {
RTMPBaseURL string `yaml:"rtmp_base_url"`
}
func NewConfig(confString string, c *cli.Context) (*Config, error) {
func NewConfig(confString string, strictMode bool, c *cli.Context) (*Config, error) {
// start with defaults
conf := &Config{
Port: 7880,
@@ -266,7 +266,7 @@ func NewConfig(confString string, c *cli.Context) (*Config, error) {
}
if confString != "" {
decoder := yaml.NewDecoder(strings.NewReader(confString))
decoder.KnownFields(true)
decoder.KnownFields(strictMode)
if err := decoder.Decode(conf); err != nil {
return nil, fmt.Errorf("could not parse config: %v", err)
}