File size: 606 Bytes
6bc074c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main

import (
	"aurora/internal/bootstrap"
	"os"

	"github.com/g-utils/endless"
)

func main() {
	app, err := bootstrap.Init()
	if err != nil {
		panic(err)
	}
	defer app.Cleanup()

	host := app.Config.ServerHost
	port := app.Config.ServerPort
	if host == "" {
		host = "0.0.0.0"
	}
	if port == "" {
		port = os.Getenv("PORT")
		if port == "" {
			port = "8080"
		}
	}

	if app.Config.TLSCert != "" && app.Config.TLSKey != "" {
		_ = endless.ListenAndServeTLS(host+":"+port, app.Config.TLSCert, app.Config.TLSKey, app.Router)
	} else {
		_ = endless.ListenAndServe(host+":"+port, app.Router)
	}
}