Skip to content

Commit

Permalink
Add StartAddrTLS function
Browse files Browse the repository at this point in the history
  • Loading branch information
agriffaut committed Apr 29, 2024
1 parent f9725ab commit 7e5131c
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 7e5131c

Please sign in to comment.