import Vapor private(set) var server: CapServer! // configures your application public func configure(_ app: Application) throws { // uncomment to serve files from /Public folder // app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory)) app.http.server.configuration.port = 6001 app.routes.defaultMaxBodySize = "2mb" let configFile = URL(fileURLWithPath: app.directory.resourcesDirectory) .appendingPathComponent("paths.conf") let configData = try String(contentsOf: configFile) .components(separatedBy: "\n") .map { $0.trimmingCharacters(in: .whitespaces) } .filter { !$0.isEmpty } guard configData.count >= 2 else { print("Invalid configuration file: \(configData.count) lines") throw CapError.invalidConfiguration } let logFile = URL(fileURLWithPath: configData[0]) let publicDirectory = URL(fileURLWithPath: configData[1]) try Log.set(logFile: logFile.path) server = try CapServer(in: publicDirectory) try server.loadCapNames() // Register routes to the router try routes(app) // Configure the rest of your application here }