Skip to content

Commit

Permalink
Merge pull request #374 from agriffaut/dev/start_addr_tls
Browse files Browse the repository at this point in the history
Add StartAddrTLS function
  • Loading branch information
alicebob authored Apr 29, 2024
2 parents f9725ab + 7e5131c commit 5abdf8a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion miniredis.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"context"
"crypto/tls"
"fmt"
"github.com/alicebob/miniredis/v2/proto"
"math/rand"
"strconv"
"strings"
"sync"
"time"

"github.com/alicebob/miniredis/v2/proto"
"github.com/alicebob/miniredis/v2/server"
)

Expand Down Expand Up @@ -195,6 +195,15 @@ func (m *Miniredis) StartAddr(addr string) error {
return m.start(s)
}

// StartAddrTLS runs miniredis with a given addr, TLS version.
func (m *Miniredis) StartAddrTLS(addr string, cfg *tls.Config) error {
s, err := server.NewServerTLS(addr, cfg)
if err != nil {
return err
}
return m.start(s)
}

func (m *Miniredis) start(s *server.Server) error {
m.Lock()
defer m.Unlock()
Expand Down

0 comments on commit 5abdf8a

Please sign in to comment.