photoprism/internal/server/server.go

26 lines
479 B
Go
Raw Normal View History

package server
import (
"fmt"
2018-09-06 14:47:32 +02:00
"github.com/gin-gonic/gin"
"github.com/photoprism/photoprism/internal/photoprism"
)
2018-09-13 20:54:34 +02:00
func Start(conf *photoprism.Config) {
if conf.ServerMode != "" {
gin.SetMode(conf.ServerMode)
2018-09-17 18:40:57 +02:00
} else if conf.Debug == false {
gin.SetMode(gin.ReleaseMode)
}
app := gin.Default()
// Set template directory
app.LoadHTMLGlob(conf.GetTemplatesPath() + "/*")
registerRoutes(app, conf)
2018-09-13 20:54:34 +02:00
app.Run(fmt.Sprintf("%s:%d", conf.ServerIP, conf.ServerPort))
}