Make a default config variable (#1848)
* Make a default config variable * decoder.Decode needs pointer to config
This commit is contained in:
@@ -264,9 +264,7 @@ func DefaultAPIConfig() APIConfig {
|
||||
}
|
||||
}
|
||||
|
||||
func NewConfig(confString string, strictMode bool, c *cli.Context, baseFlags []cli.Flag) (*Config, error) {
|
||||
// start with defaults
|
||||
conf := &Config{
|
||||
var DefaultConfig = Config{
|
||||
Port: 7880,
|
||||
RTC: RTCConfig{
|
||||
RTCConfig: rtcconfig.RTCConfig{
|
||||
@@ -423,12 +421,15 @@ func NewConfig(confString string, strictMode bool, c *cli.Context, baseFlags []c
|
||||
StreamBufferSize: 1000,
|
||||
},
|
||||
Keys: map[string]string{},
|
||||
}
|
||||
}
|
||||
|
||||
func NewConfig(confString string, strictMode bool, c *cli.Context, baseFlags []cli.Flag) (*Config, error) {
|
||||
// start with defaults
|
||||
conf := DefaultConfig
|
||||
if confString != "" {
|
||||
decoder := yaml.NewDecoder(strings.NewReader(confString))
|
||||
decoder.KnownFields(strictMode)
|
||||
if err := decoder.Decode(conf); err != nil {
|
||||
if err := decoder.Decode(&conf); err != nil {
|
||||
return nil, fmt.Errorf("could not parse config: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -473,7 +474,7 @@ func NewConfig(confString string, strictMode bool, c *cli.Context, baseFlags []c
|
||||
conf.Environment = "dev"
|
||||
}
|
||||
|
||||
return conf, nil
|
||||
return &conf, nil
|
||||
}
|
||||
|
||||
func (conf *Config) IsTURNSEnabled() bool {
|
||||
|
||||
Reference in New Issue
Block a user