fix(lint): warning from golangci-lint tool
https://github.com/appleboy/gorush/issues/704 Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
@@ -159,6 +159,7 @@ func autoTLSServer(cfg *config.ConfYaml, q *queue.Queue) *http.Server {
|
||||
Cache: autocert.DirCache(cfg.Core.AutoTLS.Folder),
|
||||
}
|
||||
|
||||
//nolint:gosec
|
||||
return &http.Server{
|
||||
Addr: ":https",
|
||||
TLSConfig: &tls.Config{GetCertificate: m.GetCertificate},
|
||||
|
||||
@@ -28,6 +28,7 @@ func RunHTTPServer(ctx context.Context, cfg *config.ConfYaml, q *queue.Queue, s
|
||||
}
|
||||
|
||||
if len(s) == 0 {
|
||||
//nolint:gosec
|
||||
server = &http.Server{
|
||||
Addr: cfg.Core.Address + ":" + cfg.Core.Port,
|
||||
Handler: routerEngine(cfg, q),
|
||||
@@ -40,6 +41,7 @@ func RunHTTPServer(ctx context.Context, cfg *config.ConfYaml, q *queue.Queue, s
|
||||
if cfg.Core.AutoTLS.Enabled {
|
||||
return startServer(ctx, autoTLSServer(cfg, q), cfg)
|
||||
} else if cfg.Core.SSL {
|
||||
//nolint
|
||||
config := &tls.Config{
|
||||
MinVersion: tls.VersionTLS10,
|
||||
}
|
||||
@@ -49,6 +51,7 @@ func RunHTTPServer(ctx context.Context, cfg *config.ConfYaml, q *queue.Queue, s
|
||||
}
|
||||
|
||||
config.Certificates = make([]tls.Certificate, 1)
|
||||
//nolint:gocritic
|
||||
if cfg.Core.CertPath != "" && cfg.Core.KeyPath != "" {
|
||||
config.Certificates[0], err = tls.LoadX509KeyPair(cfg.Core.CertPath, cfg.Core.KeyPath)
|
||||
if err != nil {
|
||||
|
||||
@@ -26,8 +26,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
goVersion = runtime.Version()
|
||||
q *queue.Queue
|
||||
goVersion = runtime.Version()
|
||||
q *queue.Queue
|
||||
testKeyPath = "../certificate/certificate-valid.pem"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -471,7 +472,7 @@ func TestSenMultipleNotifications(t *testing.T) {
|
||||
cfg := initTest()
|
||||
|
||||
cfg.Ios.Enabled = true
|
||||
cfg.Ios.KeyPath = "../certificate/certificate-valid.pem"
|
||||
cfg.Ios.KeyPath = testKeyPath
|
||||
err := notify.InitAPNSClient(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -507,7 +508,7 @@ func TestDisabledAndroidNotifications(t *testing.T) {
|
||||
cfg := initTest()
|
||||
|
||||
cfg.Ios.Enabled = true
|
||||
cfg.Ios.KeyPath = "../certificate/certificate-valid.pem"
|
||||
cfg.Ios.KeyPath = testKeyPath
|
||||
err := notify.InitAPNSClient(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -543,7 +544,7 @@ func TestSyncModeForNotifications(t *testing.T) {
|
||||
cfg := initTest()
|
||||
|
||||
cfg.Ios.Enabled = true
|
||||
cfg.Ios.KeyPath = "../certificate/certificate-valid.pem"
|
||||
cfg.Ios.KeyPath = testKeyPath
|
||||
err := notify.InitAPNSClient(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -654,7 +655,7 @@ func TestDisabledIosNotifications(t *testing.T) {
|
||||
cfg := initTest()
|
||||
|
||||
cfg.Ios.Enabled = false
|
||||
cfg.Ios.KeyPath = "../certificate/certificate-valid.pem"
|
||||
cfg.Ios.KeyPath = testKeyPath
|
||||
err := notify.InitAPNSClient(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user