Skip to content

Commit 756bbb2

Browse files
committed
Failed back to unsecure certificats if none is provide
1 parent 4f07f7e commit 756bbb2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/api.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"github.com/gorilla/mux"
2929
"github.com/signal18/replication-manager/cluster"
3030
"github.com/signal18/replication-manager/regtest"
31-
v3 "github.com/swaggest/swgui/v3"
3231
)
3332

3433
//RSA KEYS AND INITIALISATION
@@ -109,7 +108,7 @@ func (repman *ReplicationManager) apiserver() {
109108
router.PathPrefix("/static/").Handler(http.FileServer(http.Dir(repman.Conf.HttpRoot)))
110109
router.PathPrefix("/app/").Handler(http.FileServer(http.Dir(repman.Conf.HttpRoot)))
111110
router.HandleFunc("/api/login", repman.loginHandler)
112-
router.Handle("/api", v3.NewHandler("My API", "/swagger.json", "/api"))
111+
//router.Handle("/api", v3.NewHandler("My API", "/swagger.json", "/api"))
113112

114113
router.Handle("/api/clusters", negroni.New(
115114
negroni.Wrap(http.HandlerFunc(repman.handlerMuxClusters)),
@@ -152,6 +151,11 @@ func (repman *ReplicationManager) apiserver() {
152151
tlsConfig := Repmanv3TLS{
153152
Enabled: false,
154153
}
154+
// Add default unsecure cert if not set
155+
if repman.Conf.MonitoringSSLCert == "" {
156+
repman.Conf.MonitoringSSLCert = repman.Conf.ShareDir + "/server.crt"
157+
repman.Conf.MonitoringSSLKey = repman.Conf.ShareDir + "/server.key"
158+
}
155159

156160
if repman.Conf.MonitoringSSLCert != "" {
157161
tlsConfig = Repmanv3TLS{

0 commit comments

Comments
 (0)