Skip to content

Commit

Permalink
Minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
capsic committed Jul 17, 2022
1 parent 2d3e2e2 commit 02d1256
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,21 @@ func (a *App) Initialize() {

func (a *App) Run() {
port := gjson.Get(config, "port").String()
fmt.Println("Starting Confman bound to 0.0.0.0:" + port + ".")

addr := ":" + port
var err error

startMessage := "confman started on [::]:" + port

if gjson.Get(config, "ssl").Bool() {
startMessage = "confman (secure) started on [::]:" + port
fmt.Println(startMessage)

certFile := filepath.Join(os.Getenv("CONFMANHOME"), "cert", gjson.Get(config, "certFile").String())
keyFile := filepath.Join(os.Getenv("CONFMANHOME"), "cert", gjson.Get(config, "keyFile").String())
err = http.ListenAndServeTLS(addr, certFile, keyFile, a.Router)
} else {
fmt.Println(startMessage)
err = http.ListenAndServe(addr, a.Router)
}

Expand Down

0 comments on commit 02d1256

Please sign in to comment.