 }
 if let oldapi = getenv("N4L_OLDAPI_IMAGES_URL") {
     dbconfig.oldapiUrl = String(cString: oldapi)
+}
+if let apiport = getenv("N4L_API_LISTEN_PORT") {
+    listenPort = String(cString: apiport).int ?? defaultListenPort
 }
 
 let db = DBLayer(config: dbconfig)


var dbconfig = DBConfig()
var animalBackend: Model

if let dbuser = getenv("N4L_API_DATABASE_USER") {
    dbconfig.user = String(cString: dbuser)



//  an HTTP server and connect it to the router
Kitura.addHTTPServer(onPort: listenPort, with: mainRouter)

// Start the Kitura runloop (this call never returns)
Kitura.run()
