parent
6712b3b2dd
commit
f574764867
|
|
@ -4,14 +4,22 @@ import FluentPostgresDriver
|
|||
import SwiftSMTPVapor
|
||||
|
||||
public struct ManageableUsers {
|
||||
public static func configure (_ app: Application, mainMenu: [MenuItem] = [], homePageName: String = "Home", userAdminPageName: String = "User Administration") async throws {
|
||||
app.databases.use(DatabaseConfigurationFactory.postgres(configuration: .init(
|
||||
hostname: Environment.get("DATABASE_HOST") ?? "localhost",
|
||||
port: Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? SQLPostgresConfiguration.ianaPortNumber,
|
||||
username: Environment.get("DATABASE_USERNAME") ?? "sampleapp",
|
||||
password: Environment.get("DATABASE_PASSWORD") ?? "sampleapp_password",
|
||||
database: Environment.get("DATABASE_NAME") ?? "sampleapp",
|
||||
tls: .prefer(try .init(configuration: .clientDefault)))
|
||||
public static func configure (_ app: Application,
|
||||
mainMenu: [MenuItem] = [],
|
||||
homePageName: String = "Home",
|
||||
userAdminPageName: String = "User Administration",
|
||||
maxConnectionsPerEventLoop: Int = 1,
|
||||
connectionPoolTimeout: TimeAmount = .seconds(10),
|
||||
sqlLogLevel: Logger.Level = .debug) async throws {
|
||||
app.databases.use(DatabaseConfigurationFactory.postgres(configuration: .init (hostname: Environment.get("DATABASE_HOST") ?? "localhost",
|
||||
port: Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? SQLPostgresConfiguration.ianaPortNumber,
|
||||
username: Environment.get("DATABASE_USERNAME") ?? "sampleapp",
|
||||
password: Environment.get("DATABASE_PASSWORD") ?? "sampleapp_password",
|
||||
database: Environment.get("DATABASE_NAME") ?? "sampleapp",
|
||||
tls: .prefer(try .init(configuration: .clientDefault))),
|
||||
maxConnectionsPerEventLoop: maxConnectionsPerEventLoop,
|
||||
connectionPoolTimeout: connectionPoolTimeout,
|
||||
sqlLogLevel: sqlLogLevel
|
||||
), as: .psql)
|
||||
|
||||
_ = try Environment.baseURL
|
||||
|
|
|
|||
Loading…
Reference in New Issue