You've already forked openaccounting-server
mirror of
https://github.com/openaccounting/oa-server.git
synced 2025-12-09 00:50:59 +13:00
Enable the server to run without SSL if not certificate is provided
This commit is contained in:
@@ -47,6 +47,10 @@ func main() {
|
||||
log.Fatal(fmt.Errorf("failed to create api instance with: %s", err.Error()))
|
||||
}
|
||||
|
||||
err = http.ListenAndServeTLS(":"+strconv.Itoa(config.Port), config.CertFile, config.KeyFile, app.MakeHandler())
|
||||
if config.CertFile == "" || config.KeyFile == "" {
|
||||
err = http.ListenAndServe(":"+strconv.Itoa(config.Port), app.MakeHandler())
|
||||
} else {
|
||||
err = http.ListenAndServeTLS(":"+strconv.Itoa(config.Port), config.CertFile, config.KeyFile, app.MakeHandler())
|
||||
}
|
||||
log.Fatal(fmt.Errorf("failed to start server with: %s", err.Error()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user