mirror of
https://github.com/vapor/template-fluent-postgres.git
synced 2025-04-20 09:27:08 +08:00
Automatic generation from github.com/vapor/template
This commit is contained in:
parent
10a17dd9cb
commit
cbe017b921
@ -10,7 +10,7 @@ let package = Package(
|
||||
// 💧 A server-side Swift web framework.
|
||||
.package(url: "https://github.com/vapor/vapor.git", from: "4.76.0"),
|
||||
.package(url: "https://github.com/vapor/fluent.git", from: "4.8.0"),
|
||||
.package(url: "https://github.com/vapor/fluent-postgres-driver.git", from: "2.0.0"),
|
||||
.package(url: "https://github.com/vapor/fluent-postgres-driver.git", from: "2.7.2"),
|
||||
],
|
||||
targets: [
|
||||
.executableTarget(
|
||||
|
@ -1,3 +1,4 @@
|
||||
import NIOSSL
|
||||
import Fluent
|
||||
import FluentPostgresDriver
|
||||
import Vapor
|
||||
@ -7,12 +8,13 @@ public func configure(_ app: Application) async throws {
|
||||
// uncomment to serve files from /Public folder
|
||||
// app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
|
||||
|
||||
app.databases.use(.postgres(
|
||||
app.databases.use(.postgres(configuration: .init(
|
||||
hostname: Environment.get("DATABASE_HOST") ?? "localhost",
|
||||
port: Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? PostgresConfiguration.ianaPortNumber,
|
||||
port: Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? SQLPostgresConfiguration.ianaPortNumber,
|
||||
username: Environment.get("DATABASE_USERNAME") ?? "vapor_username",
|
||||
password: Environment.get("DATABASE_PASSWORD") ?? "vapor_password",
|
||||
database: Environment.get("DATABASE_NAME") ?? "vapor_database"
|
||||
database: Environment.get("DATABASE_NAME") ?? "vapor_database",
|
||||
tls: .prefer(try .init(configuration: .clientDefault)))
|
||||
), as: .psql)
|
||||
|
||||
app.migrations.add(CreateTodo())
|
||||
|
Loading…
x
Reference in New Issue
Block a user