Add environment variables to disable features

Face detection still needs to be hidden on the frontend if it's disabled
This commit is contained in:
viktorstrate
2021-08-31 11:34:55 +02:00
parent fca5a640c8
commit 9bcfdbb2cd
10 changed files with 188 additions and 12 deletions

View File

@@ -19,9 +19,13 @@ type FaceDetector struct {
imageFaceIDs []int
}
var GlobalFaceDetector FaceDetector
var GlobalFaceDetector *FaceDetector = nil
func InitializeFaceDetector(db *gorm.DB) error {
if utils.EnvDisableRawProcessing.GetBool() {
log.Printf("Face detection disabled (%s=1)\n", utils.EnvDisableRawProcessing.GetName())
return nil
}
log.Println("Initializing face detector")
@@ -35,7 +39,7 @@ func InitializeFaceDetector(db *gorm.DB) error {
return errors.Wrap(err, "get face detection samples from database")
}
GlobalFaceDetector = FaceDetector{
GlobalFaceDetector = &FaceDetector{
rec: rec,
faceDescriptors: faceDescriptors,
faceGroupIDs: faceGroupIDs,