File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 9
9
"fmt"
10
10
"io"
11
11
"log"
12
+ "net/http"
12
13
"os"
13
14
"strings"
14
15
"time"
@@ -202,16 +203,25 @@ func Listen(s *smtp.Server) {
202
203
log .Println ("Starting server at" , s .Addr )
203
204
if err := s .ListenAndServe (); err != nil {
204
205
log .Fatal (err )
206
+ panic (err )
205
207
}
206
208
}
207
209
208
210
func ListemSmtps (tlss * smtp.Server ) {
209
211
log .Println ("Starting TLS server at " , tlss .Addr )
210
212
if err := tlss .ListenAndServeTLS (); err != nil {
211
213
log .Fatal (err )
214
+ panic (err )
212
215
}
213
216
}
214
217
218
+ func ListenHealthcheck () {
219
+ http .ListenAndServe (":8080" , http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
220
+ w .WriteHeader (200 )
221
+ w .Write ([]byte ("OK" ))
222
+ })) // nolint:errcheck
223
+ }
224
+
215
225
func main () {
216
226
// Create config
217
227
config = & Config {}
@@ -244,6 +254,10 @@ func main() {
244
254
config .Server .TLSKey ,
245
255
)
246
256
257
+ if err != nil {
258
+ log .Fatal (err )
259
+ }
260
+
247
261
certInfo , err := x509 .ParseCertificate (tlsCert .Certificate [0 ])
248
262
249
263
if err != nil {
@@ -316,5 +330,7 @@ func main() {
316
330
go ListemSmtps (smtpss )
317
331
}
318
332
319
- Listen (smtps )
333
+ go Listen (smtps )
334
+
335
+ ListenHealthcheck ()
320
336
}
You can’t perform that action at this time.
0 commit comments