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-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 {
|
|
|
|
Import *photoprism.Import
|
|
|
|
Index *photoprism.Index
|
|
|
|
Nsfw *nsfw.Detector
|
|
|
|
Convert *photoprism.Convert
|
|
|
|
Resample *photoprism.Resample
|
|
|
|
Classify *classify.TensorFlow
|
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
|
|
|
}
|