Add some logging & version info building
This commit is contained in:
parent
e458bb1328
commit
a60c2f2d2f
18
app.go
18
app.go
|
|
@ -4,14 +4,30 @@ import (
|
|||
"math/rand"
|
||||
"time"
|
||||
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gotify/server/config"
|
||||
"github.com/gotify/server/database"
|
||||
"github.com/gotify/server/model"
|
||||
"github.com/gotify/server/router"
|
||||
"github.com/gotify/server/runner"
|
||||
)
|
||||
|
||||
var (
|
||||
// Version the version of Gotify.
|
||||
Version = "unknown"
|
||||
// Commit the git commit hash of this version.
|
||||
Commit = "unknown"
|
||||
// BuildDate the date on which this binary was build.
|
||||
BuildDate = "unknown"
|
||||
// Branch the git branch of this version.
|
||||
Branch = "unknown"
|
||||
vInfo = &model.VersionInfo{Version: Version, Commit: Commit, BuildDate: BuildDate, Branch: Branch}
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Starting Gotify version", Version+"@"+BuildDate)
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
conf := config.Get()
|
||||
db, err := database.New(conf.Database.Dialect, conf.Database.Connection, conf.DefaultUser.Name, conf.DefaultUser.Pass)
|
||||
|
|
@ -21,7 +37,7 @@ func main() {
|
|||
defer db.Close()
|
||||
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
engine, closeable := router.Create(db)
|
||||
engine, closeable := router.Create(db, vInfo)
|
||||
defer closeable()
|
||||
|
||||
runner.Run(engine, conf)
|
||||
|
|
|
|||
|
|
@ -37,8 +37,10 @@ func Run(engine *gin.Engine, conf *config.Configuration) {
|
|||
httpHandler = certManager.HTTPHandler(httpHandler)
|
||||
s.TLSConfig = &tls.Config{GetCertificate: certManager.GetCertificate}
|
||||
}
|
||||
fmt.Println("Started Listening on port", conf.Server.SSL.Port)
|
||||
go log.Fatal(s.ListenAndServeTLS(conf.Server.SSL.CertFile, conf.Server.SSL.CertKey))
|
||||
}
|
||||
fmt.Println("Started Listening on port", conf.Server.Port)
|
||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", conf.Server.Port), httpHandler))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue