feat: support to read MODELS_PATH env var

This commit is contained in:
Jan Halfar 2024-04-29 10:14:34 +02:00
parent 928b96cc20
commit 97b19facad
2 changed files with 5 additions and 3 deletions

View File

@ -6,10 +6,8 @@ enum Entrypoint {
static func main() async throws {
var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)
let app = Application(env)
defer { app.shutdown() }
do {
try await configure(app)
} catch {

View File

@ -1,7 +1,11 @@
import Vapor
func routes(_ app: Application) throws {
let recoController = RecognitionController(modelsPath: "")
var modelsPath = ""
if Environment.get("MODELS_PATH") != nil {
modelsPath = Environment.get("MODELS_PATH")!
}
let recoController = RecognitionController(modelsPath: modelsPath)
try app.register(collection: recoController)
try recoController.loadModel()
}