Ability to disable auto-create (#361)

* setting to disable autocreate

* improve test reliability

* update comment

* update to address feedback
This commit is contained in:
David Zhao
2022-01-21 09:57:36 -08:00
committed by GitHub
parent 7f4ead9b25
commit 126bb8867b
13 changed files with 178 additions and 22 deletions
+3
View File
@@ -103,6 +103,8 @@ type RedisConfig struct {
}
type RoomConfig struct {
// enable rooms to be automatically created
AutoCreate bool `yaml:"auto_create"`
EnabledCodecs []CodecSpec `yaml:"enabled_codecs"`
MaxParticipants uint32 `yaml:"max_participants"`
EmptyTimeout uint32 `yaml:"empty_timeout"`
@@ -187,6 +189,7 @@ func NewConfig(confString string, c *cli.Context) (*Config, error) {
},
Redis: RedisConfig{},
Room: RoomConfig{
AutoCreate: true,
// by default only enable opus and VP8
EnabledCodecs: []CodecSpec{
{Mime: webrtc.MimeTypeOpus},
+9
View File
@@ -13,3 +13,12 @@ func TestConfig_UnmarshalKeys(t *testing.T) {
require.NoError(t, conf.unmarshalKeys("key1: secret1"))
require.Equal(t, "secret1", conf.Keys["key1"])
}
func TestConfig_DefaultsKept(t *testing.T) {
const content = `room:
empty_timeout: 10`
conf, err := NewConfig(content, nil)
require.NoError(t, err)
require.Equal(t, true, conf.Room.AutoCreate)
require.Equal(t, uint32(10), conf.Room.EmptyTimeout)
}