Skip to content

Commit 92a7a70

Browse files
committed
BUG/MINOR: avoid duplication of xxx no-xxx options on serialization
1 parent 7b075ee commit 92a7a70

File tree

1 file changed

+9
-32
lines changed

1 file changed

+9
-32
lines changed

configuration/server.go

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -647,52 +647,29 @@ func SerializeServerParams(s models.ServerParams, opt *options.ConfigurationOpti
647647
s.NoSslv3 == "enabled" { // deprecated, keeping the behavior, for backward compatibility. Can be removed when field is removed
648648
options = append(options, &params.ServerOptionWord{Name: "no-sslv3"})
649649
}
650-
if s.Tlsv10 == "enabled" {
650+
if s.Tlsv10 == "enabled" || s.ForceTlsv10 == "enabled" {
651651
options = append(options, &params.ServerOptionWord{Name: "force-tlsv10"})
652652
}
653-
if s.Tlsv10 == "disabled" {
653+
if s.Tlsv10 == "disabled" || s.ForceTlsv10 == "disabled" {
654654
options = append(options, &params.ServerOptionWord{Name: "no-tlsv10"})
655655
}
656-
if s.ForceTlsv10 == "enabled" {
657-
options = append(options, &params.ServerOptionWord{Name: "force-tlsv10"})
658-
}
659-
if s.ForceTlsv10 == "disabled" {
660-
options = append(options, &params.ServerOptionWord{Name: "no-tlsv10"})
661-
}
662-
if s.Tlsv11 == "enabled" {
656+
if s.Tlsv11 == "enabled" || s.ForceTlsv11 == "enabled" {
663657
options = append(options, &params.ServerOptionWord{Name: "force-tlsv11"})
664658
}
665-
if s.Tlsv11 == "disabled" {
659+
if s.Tlsv11 == "disabled" || s.ForceTlsv11 == "disabled" {
666660
options = append(options, &params.ServerOptionWord{Name: "no-tlsv11"})
667661
}
668-
if s.ForceTlsv11 == "enabled" {
669-
options = append(options, &params.ServerOptionWord{Name: "force-tlsv11"})
670-
}
671-
if s.ForceTlsv11 == "disabled" {
672-
options = append(options, &params.ServerOptionWord{Name: "no-tlsv11"})
673-
}
674-
if s.Tlsv12 == "enabled" {
675-
options = append(options, &params.ServerOptionWord{Name: "force-tlsv12"})
676-
}
677-
if s.Tlsv12 == "disabled" {
678-
options = append(options, &params.ServerOptionWord{Name: "no-tlsv12"})
679-
}
680-
if s.ForceTlsv12 == "enabled" {
662+
663+
if s.Tlsv12 == "enabled" || s.ForceTlsv12 == "enabled" {
681664
options = append(options, &params.ServerOptionWord{Name: "force-tlsv12"})
682665
}
683-
if s.ForceTlsv12 == "disabled" {
666+
if s.Tlsv12 == "disabled" || s.ForceTlsv12 == "disabled" {
684667
options = append(options, &params.ServerOptionWord{Name: "no-tlsv12"})
685668
}
686-
if s.Tlsv13 == "enabled" {
687-
options = append(options, &params.ServerOptionWord{Name: "force-tlsv13"})
688-
}
689-
if s.Tlsv13 == "disabled" {
690-
options = append(options, &params.ServerOptionWord{Name: "no-tlsv13"})
691-
}
692-
if s.ForceTlsv13 == "enabled" {
669+
if s.Tlsv13 == "enabled" || s.ForceTlsv13 == "enabled" {
693670
options = append(options, &params.ServerOptionWord{Name: "force-tlsv13"})
694671
}
695-
if s.ForceTlsv13 == "disabled" {
672+
if s.Tlsv13 == "disabled" || s.ForceTlsv13 == "disabled" {
696673
options = append(options, &params.ServerOptionWord{Name: "no-tlsv13"})
697674
}
698675
if s.Maintenance == "enabled" {

0 commit comments

Comments
 (0)