2018-07-20 14:13:52 +02:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2018-09-06 14:47:32 +02:00
|
|
|
"github.com/gin-gonic/gin"
|
2018-08-03 15:17:13 +02:00
|
|
|
"github.com/photoprism/photoprism"
|
2018-07-20 14:13:52 +02:00
|
|
|
)
|
|
|
|
|
2018-09-13 11:34:56 +02:00
|
|
|
func Start(address string, port int, mode string, conf *photoprism.Config) {
|
|
|
|
if mode != "" {
|
|
|
|
gin.SetMode(mode)
|
|
|
|
} else if conf.Debug == false{
|
|
|
|
gin.SetMode(gin.ReleaseMode)
|
|
|
|
}
|
|
|
|
|
2018-09-13 07:05:13 +02:00
|
|
|
app := gin.Default()
|
2018-07-20 14:13:52 +02:00
|
|
|
|
2018-09-13 07:05:13 +02:00
|
|
|
ConfigureRoutes(app, conf)
|
2018-07-20 14:13:52 +02:00
|
|
|
|
2018-09-13 07:05:13 +02:00
|
|
|
app.Run(fmt.Sprintf("%s:%d", address, port))
|
2018-07-20 14:13:52 +02:00
|
|
|
}
|