     let dbHostname = Environment.get("DB_HOSTNAME") ?? "localhost"
     let dbUsername = Environment.get("DB_USER") ?? "test"
     let db = Environment.get("DB_DATABASE") ?? "test"
-    let dbPort = Environment.get("DB_PORT")?.intValue ?? 5432
+    let dbPort = Int(Environment.get("DB_PORT") ?? "5432") ?? 5432
     let dbPassword = Environment.get("DB_PASSWORD")
 
     // Register providers first


    // Register middleware
    var middlewares = MiddlewareConfig()
    middlewares.use(DateMiddleware.self)
    middlewares.use(ErrorMiddleware.self)
    middlewares.use(FileMiddleware.self)
    services.register(middlewares)

    // Configure a SQLite database

    let databases = PostgreSQLDatabase(config: PostgreSQLDatabaseConfig(hostname: dbHostname, port: dbPort, username: dbUsername, database: db, password: dbPassword))
    databases.enableLogging(using: DatabaseLogger.print)
    
    services.register(databases)

    // Configure migrations

import Stripe
import SendGrid

let databaseLogger = DatabaseLogger(database: .psql, handler: PrintLogHandler())

public func configure(_ config: inout Config, env: inout Environment, services: inout Services) throws {
    let sendGridKey = Environment.get("SENDGRID_API_KEY") ?? "SENDGRID_API_KEY"
    let stripeKey = Environment.get("STRIPE_API_KEY") ?? "STRIPE_API_KEY"
