Skip to content

Commit 2565a32

Browse files
committed
Add a tlskey and tlscert configuration option
1 parent 0a871bd commit 2565a32

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

main.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,18 @@ func main() {
126126
}
127127

128128
func tlsbind() net.Listener {
129+
certPath := v.GetString("tlsdir") + "/cert.pem"
130+
keyPath := v.GetString("tlsdir") + "/key.pem"
129131

130-
kpr, err := NewKeypairReloader(v.GetString("tlsdir")+"/cert.pem", v.GetString("tlsdir")+"/key.pem")
132+
if v.GetString("tlscert") != "" {
133+
certPath = v.GetString("tlscert")
134+
}
135+
136+
if v.GetString("tlskey") != "" {
137+
keyPath = v.GetString("tlskey")
138+
}
139+
140+
kpr, err := NewKeypairReloader(certPath, keyPath)
131141
if err != nil {
132142
logger.Errorf("could not load TLS, incorrect directory? Error: %s", err)
133143
os.Exit(1)

matterircd.toml.example

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ gops = false
1818

1919
#directory to look for key.pem and cert.pem. (default ".")
2020
#
21-
#TLSDir = "/etc/pki/tls/matermost/"
21+
#TLSDir = "/etc/pki/tls/matterircd/"
22+
23+
# Specify the full path for your key and cert
24+
#TLSKey = "/etc/pki/tls/matterircd/key.pem"
25+
#TLSCert = "/etc/pki/tls/matterircd/cer.pem"
2226

2327
#PasteBufferTimeout specifies the amount of time in milliseconds that
2428
#messages get kept in matterircd internal buffer before being sent to

tlsutil.go

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type keypairReloader struct {
1616
keyPath string
1717
}
1818

19+
// nolint:golint
1920
func NewKeypairReloader(certPath, keyPath string) (*keypairReloader, error) {
2021
result := &keypairReloader{
2122
certPath: certPath,

0 commit comments

Comments
 (0)