Skip to content

Commit

Permalink
support 'false' and 'true' values of 'encryption' parameter (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Dec 19, 2020
1 parent 98a443d commit 939dda0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ func (conf *Conf) fillAndCheck() error {
conf.Encryption = "no"
}
switch conf.Encryption {
case "no":
case "no", "false":
conf.EncryptionParsed = EncryptionNo

case "optional":
conf.EncryptionParsed = EncryptionOptional

case "yes":
case "yes", "true":
conf.EncryptionParsed = EncryptionYes

if _, ok := conf.ProtocolsParsed[gortsplib.StreamProtocolUDP]; ok {
Expand Down

3 comments on commit 939dda0

@dorinclisu
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aler9 I see that encryption is defined as a string in the Conf struct. Any particular reason for not using bool like all the other parameters? Because this commit doesn't really fix the bug, as it will still fail with valid YAML values like True, TRUE or Yes, which other yaml serializers might dump.

@aler9
Copy link
Member Author

@aler9 aler9 commented on 939dda0 Dec 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dorinclisu encryption must also accept the "optional" value, so it can't be stored in a bool - i should have chosen the "strict" value instead of "yes" to make it more clear

@dorinclisu
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a better way to handle "optional" is to still keep encryption boolean but have its presence optional. So if the field is not present in the config file, it is treated as optional, if it is present then it's treated as strict yes/no.

Please sign in to comment.