photoprism/internal/server/server.go

27 lines
541 B
Go
Raw Normal View History

package server
import (
"fmt"
2018-09-06 12:47:32 +00:00
"github.com/gin-gonic/gin"
"github.com/photoprism/photoprism/internal/photoprism"
)
2018-11-06 18:02:03 +00:00
// Start the REST API server using the configuration provided
2018-09-13 18:54:34 +00:00
func Start(conf *photoprism.Config) {
if conf.ServerMode != "" {
gin.SetMode(conf.ServerMode)
2018-09-17 16:40:57 +00: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 18:54:34 +00:00
app.Run(fmt.Sprintf("%s:%d", conf.ServerIP, conf.ServerPort))
}