Skip to content

Commit

Permalink
start secure https server
Browse files Browse the repository at this point in the history
  • Loading branch information
sd-cyberinc committed Mar 8, 2021
1 parent 5004e43 commit 82eb27e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,13 @@ func (app *App) Initialize(routeSpecifiers []RouteSpecifier) {

//Start http server and start listening to the requests
func (app *App) Start() {
if err := app.server.ListenAndServe(); err != nil {
if err != http.ErrServerClosed {
app.log.Fatal().Err(err).Msg("Unable to start server, exiting the application!")
if app.Config.GetString("ENABLE_TLS") == "true" {
app.StartSecure("SERVER_CERT", "SERVER_KEY")
} else {
if err := app.server.ListenAndServe(); err != nil {
if err != http.ErrServerClosed {
app.log.Fatal().Err(err).Msg("Unable to start server, exiting the application!")
}
}
}
}
Expand Down

0 comments on commit 82eb27e

Please sign in to comment.