2020-03-29 11:29:02 +02:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
2020-04-05 22:26:53 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/classify"
|
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
|
|
|
"github.com/photoprism/photoprism/internal/nsfw"
|
|
|
|
"github.com/photoprism/photoprism/internal/photoprism"
|
2020-04-30 20:07:03 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/query"
|
2020-04-20 13:50:28 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/session"
|
2020-03-29 11:29:02 +02:00
|
|
|
)
|
|
|
|
|
2020-04-05 22:26:53 +02:00
|
|
|
var conf *config.Config
|
2020-03-29 11:29:02 +02:00
|
|
|
|
2020-04-05 22:26:53 +02:00
|
|
|
var services struct {
|
2020-05-01 09:57:38 +02:00
|
|
|
Classify *classify.TensorFlow
|
|
|
|
Convert *photoprism.Convert
|
2020-04-05 22:26:53 +02:00
|
|
|
Import *photoprism.Import
|
|
|
|
Index *photoprism.Index
|
2020-05-07 19:42:04 +02:00
|
|
|
Purge *photoprism.Purge
|
2020-04-05 22:26:53 +02:00
|
|
|
Nsfw *nsfw.Detector
|
2020-05-01 09:57:38 +02:00
|
|
|
Query *query.Query
|
2020-04-05 22:26:53 +02:00
|
|
|
Resample *photoprism.Resample
|
2020-04-20 13:50:28 +02:00
|
|
|
Session *session.Session
|
2020-03-29 11:29:02 +02:00
|
|
|
}
|
|
|
|
|
2020-04-06 22:27:05 +02:00
|
|
|
func SetConfig(c *config.Config) {
|
2020-04-05 22:26:53 +02:00
|
|
|
if c == nil {
|
|
|
|
panic("config is nil")
|
2020-03-29 11:29:02 +02:00
|
|
|
}
|
|
|
|
|
2020-04-05 22:26:53 +02:00
|
|
|
conf = c
|
2020-03-29 11:29:02 +02:00
|
|
|
}
|
|
|
|
|
2020-04-05 22:26:53 +02:00
|
|
|
func Config() *config.Config {
|
|
|
|
if conf == nil {
|
|
|
|
panic("config is nil")
|
2020-03-29 11:29:02 +02:00
|
|
|
}
|
|
|
|
|
2020-04-05 22:26:53 +02:00
|
|
|
return conf
|
2020-03-29 11:29:02 +02:00
|
|
|
}
|