summaryrefslogtreecommitdiff
path: root/pkg/cfg/tls.go
blob: 6441df8fea98edcab5c0cb57c03c6f54a2714682 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package cfg

import (
	"crypto/tls"

	"github.com/xlgmokha/x/pkg/x"
)

func WithSelfSigned(cert, key string) Option {
	certificate := x.Must(tls.LoadX509KeyPair(cert, key))

	return func(config *Config) {
		config.TLS = &tls.Config{
			MinVersion:   tls.VersionTLS13,
			Certificates: []tls.Certificate{certificate},
		}
	}
}