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