Skip to content

Commit 830c200

Browse files
committed
BUG/MINOR: avoid duplication of xxx no-xxx options on serialization
1 parent 341684e commit 830c200

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
@@ -656,52 +656,29 @@ func SerializeServerParams(s models.ServerParams, opt *options.ConfigurationOpti
656656
s.NoSslv3 == "enabled" { // deprecated, keeping the behavior, for backward compatibility. Can be removed when field is removed
657657
options = append(options, &params.ServerOptionWord{Name: "no-sslv3"})
658658
}
659-
if s.Tlsv10 == "enabled" {
659+
if s.Tlsv10 == "enabled" || s.ForceTlsv10 == "enabled" {
660660
options = append(options, &params.ServerOptionWord{Name: "force-tlsv10"})
661661
}
662-
if s.Tlsv10 == "disabled" {
662+
if s.Tlsv10 == "disabled" || s.ForceTlsv10 == "disabled" {
663663
options = append(options, &params.ServerOptionWord{Name: "no-tlsv10"})
664664
}
665-
if s.ForceTlsv10 == "enabled" {
666-
options = append(options, &params.ServerOptionWord{Name: "force-tlsv10"})
667-
}
668-
if s.ForceTlsv10 == "disabled" {
669-
options = append(options, &params.ServerOptionWord{Name: "no-tlsv10"})
670-
}
671-
if s.Tlsv11 == "enabled" {
665+
if s.Tlsv11 == "enabled" || s.ForceTlsv11 == "enabled" {
672666
options = append(options, &params.ServerOptionWord{Name: "force-tlsv11"})
673667
}
674-
if s.Tlsv11 == "disabled" {
668+
if s.Tlsv11 == "disabled" || s.ForceTlsv11 == "disabled" {
675669
options = append(options, &params.ServerOptionWord{Name: "no-tlsv11"})
676670
}
677-
if s.ForceTlsv11 == "enabled" {
678-
options = append(options, &params.ServerOptionWord{Name: "force-tlsv11"})
679-
}
680-
if s.ForceTlsv11 == "disabled" {
681-
options = append(options, &params.ServerOptionWord{Name: "no-tlsv11"})
682-
}
683-
if s.Tlsv12 == "enabled" {
684-
options = append(options, &params.ServerOptionWord{Name: "force-tlsv12"})
685-
}
686-
if s.Tlsv12 == "disabled" {
687-
options = append(options, &params.ServerOptionWord{Name: "no-tlsv12"})
688-
}
689-
if s.ForceTlsv12 == "enabled" {
671+
672+
if s.Tlsv12 == "enabled" || s.ForceTlsv12 == "enabled" {
690673
options = append(options, &params.ServerOptionWord{Name: "force-tlsv12"})
691674
}
692-
if s.ForceTlsv12 == "disabled" {
675+
if s.Tlsv12 == "disabled" || s.ForceTlsv12 == "disabled" {
693676
options = append(options, &params.ServerOptionWord{Name: "no-tlsv12"})
694677
}
695-
if s.Tlsv13 == "enabled" {
696-
options = append(options, &params.ServerOptionWord{Name: "force-tlsv13"})
697-
}
698-
if s.Tlsv13 == "disabled" {
699-
options = append(options, &params.ServerOptionWord{Name: "no-tlsv13"})
700-
}
701-
if s.ForceTlsv13 == "enabled" {
678+
if s.Tlsv13 == "enabled" || s.ForceTlsv13 == "enabled" {
702679
options = append(options, &params.ServerOptionWord{Name: "force-tlsv13"})
703680
}
704-
if s.ForceTlsv13 == "disabled" {
681+
if s.Tlsv13 == "disabled" || s.ForceTlsv13 == "disabled" {
705682
options = append(options, &params.ServerOptionWord{Name: "no-tlsv13"})
706683
}
707684
if s.Maintenance == "enabled" {

0 commit comments

Comments
 (0)