Skip to content

Commit 2a6a622

Browse files
committed
configure accepts databasePort: Int? input
1 parent e84ce77 commit 2a6a622

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/App/configure.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Vapor
1919

2020

2121
@discardableResult
22-
public func configure(_ app: Application) async throws -> String {
22+
public func configure(_ app: Application, databasePort: Int? = nil) async throws -> String {
2323
#if DEBUG && os(macOS)
2424
// The bundle is only loaded if /Applications/InjectionIII.app exists on the local development machine.
2525
// Requires InjectionIII 4.7.3 or higher to be loaded for compatibility with Package.swift files.
@@ -55,7 +55,7 @@ public func configure(_ app: Application) async throws -> String {
5555
// Setup database connection
5656
guard
5757
let host = Environment.get("DATABASE_HOST"),
58-
let port = Environment.get("DATABASE_PORT").flatMap(Int.init),
58+
let port = databasePort ?? Environment.get("DATABASE_PORT").flatMap(Int.init),
5959
let username = Environment.get("DATABASE_USERNAME"),
6060
let password = Environment.get("DATABASE_PASSWORD"),
6161
let database = Environment.get("DATABASE_NAME")

0 commit comments

Comments
 (0)