Skip to content

Commit

Permalink
update swift
Browse files Browse the repository at this point in the history
  • Loading branch information
elmoritz committed Apr 12, 2024
1 parent a788e0a commit 337c7c8
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 53 deletions.
2 changes: 1 addition & 1 deletion bookstore-vapor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ================================
# Build image
# ================================
FROM swift:5.9-slim as build
FROM swift:5.10-slim as build

# Install OS updates and, if needed, sqlite3
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
Expand Down
119 changes: 78 additions & 41 deletions bookstore-vapor/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
{
"originHash" : "cde2226e8c9b5a5d8d0d6049152bdfd562a8dcf76197cb05b9a5db0febf63722",
"pins" : [
{
"identity" : "async-http-client",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swift-server/async-http-client.git",
"state" : {
"revision" : "16f7e62c08c6969899ce6cc277041e868364e5cf",
"version" : "1.19.0"
"revision" : "fb308ee72f3d4c082a507033f94afa7395963ef3",
"version" : "1.21.0"
}
},
{
"identity" : "async-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/async-kit.git",
"state" : {
"revision" : "eab9edff78e8ace20bd7cb6e792ab46d54f59ab9",
"version" : "1.18.0"
"revision" : "7ece208cd401687641c88367a00e3ea2b04311f1",
"version" : "1.19.0"
}
},
{
"identity" : "console-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/console-kit.git",
"state" : {
"revision" : "ccd0773b3ad3c67a19918aaef6903678592bb087",
"version" : "4.9.0"
"revision" : "a31f44ebfbd15a2cc0fda705279676773ac16355",
"version" : "4.14.1"
}
},
{
"identity" : "fluent",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/fluent.git",
"state" : {
"revision" : "4b4d8bf15a06fd60137e9c543e5503c4b842654e",
"version" : "4.8.0"
"revision" : "a586a5d4164f23a0ee4e02e1f467b9bbef0c9f1c",
"version" : "4.9.0"
}
},
{
"identity" : "fluent-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/fluent-kit.git",
"state" : {
"revision" : "e0bb2b060249b7a501249b1612807b2eaaec28c6",
"version" : "1.45.0"
"revision" : "5f0938a3f5f1a751ff7a411117bfce4efe713526",
"version" : "1.47.2"
}
},
{
Expand All @@ -59,35 +60,35 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/multipart-kit.git",
"state" : {
"revision" : "1adfd69df2da08f7931d4281b257475e32c96734",
"version" : "4.5.4"
"revision" : "12ee56f25bd3fc4c2d09c2aa16e69de61dc786e8",
"version" : "4.6.0"
}
},
{
"identity" : "postgres-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/postgres-kit.git",
"state" : {
"revision" : "80ab7737dac4fccd4a8ad38743828dcb71ba7ac8",
"version" : "2.12.2"
"revision" : "e26763a6cb8d852f7ce01b1cd5925b3d8d084801",
"version" : "2.13.1"
}
},
{
"identity" : "postgres-nio",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/postgres-nio.git",
"state" : {
"revision" : "abca6b390235ae337999d367c40cc40c99629385",
"version" : "1.18.1"
"revision" : "e345cbb9cf6052b37b27c0c4f976134fc01dbe15",
"version" : "1.21.1"
}
},
{
"identity" : "routing-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/routing-kit.git",
"state" : {
"revision" : "e0539da5b60a60d7381f44cdcf04036f456cee2f",
"version" : "4.8.0"
"revision" : "2a92a7eac411a82fb3a03731be5e76773ebe1b3e",
"version" : "4.9.0"
}
},
{
Expand All @@ -104,8 +105,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-algorithms.git",
"state" : {
"revision" : "bcd4f369ac962bc3e5244c9df778739f8f5bdbf1",
"version" : "1.1.0"
"revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42",
"version" : "1.2.0"
}
},
{
"identity" : "swift-async-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-async-algorithms.git",
"state" : {
"revision" : "da4e36f86544cdf733a40d59b3a2267e3a7bbf36",
"version" : "1.0.0"
}
},
{
Expand All @@ -122,26 +132,35 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "a902f1823a7ff3c9ab2fba0f992396b948eda307",
"version" : "1.0.5"
"revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
"version" : "1.1.0"
}
},
{
"identity" : "swift-crypto",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-crypto.git",
"state" : {
"revision" : "60f13f60c4d093691934dc6cfdf5f508ada1f894",
"version" : "2.6.0"
"revision" : "f0525da24dc3c6cbb2b6b338b65042bc91cbc4bb",
"version" : "3.3.0"
}
},
{
"identity" : "swift-http-types",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-types",
"state" : {
"revision" : "12358d55a3824bd5fed310b999ea8cf83a9a1a65",
"version" : "1.0.3"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "532d8b529501fb73a2455b179e0bbb6d49b652ed",
"version" : "1.5.3"
"revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5",
"version" : "1.5.4"
}
},
{
Expand All @@ -158,44 +177,44 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "3db5c4aeee8100d2db6f1eaf3864afdad5dc68fd",
"version" : "2.59.0"
"revision" : "fc63f0cf4e55a4597407a9fc95b16a2bc44b4982",
"version" : "2.64.0"
}
},
{
"identity" : "swift-nio-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-extras.git",
"state" : {
"revision" : "fb70a0f5e984f23be48b11b4f1909f3bee016178",
"version" : "1.19.1"
"revision" : "a3b640d7dc567225db7c94386a6e71aded1bfa63",
"version" : "1.22.0"
}
},
{
"identity" : "swift-nio-http2",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-http2.git",
"state" : {
"revision" : "9c22e4f810ce780453f563fba98e1a1039f83d56",
"version" : "1.28.1"
"revision" : "0904bf0feb5122b7e5c3f15db7df0eabe623dd87",
"version" : "1.30.0"
}
},
{
"identity" : "swift-nio-ssl",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-ssl.git",
"state" : {
"revision" : "320bd978cceb8e88c125dcbb774943a92f6286e9",
"version" : "2.25.0"
"revision" : "7c381eb6083542b124a6c18fae742f55001dc2b5",
"version" : "2.26.0"
}
},
{
"identity" : "swift-nio-transport-services",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-transport-services.git",
"state" : {
"revision" : "e7403c35ca6bb539a7ca353b91cc2d8ec0362d58",
"version" : "1.19.0"
"revision" : "6cbe0ed2b394f21ab0d46b9f0c50c6be964968ce",
"version" : "1.20.1"
}
},
{
Expand All @@ -207,24 +226,42 @@
"version" : "1.0.2"
}
},
{
"identity" : "swift-service-lifecycle",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swift-server/swift-service-lifecycle.git",
"state" : {
"revision" : "d7fe0e731499a8dcce53bf4cbbc812c8e565d3a7",
"version" : "2.4.1"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"state" : {
"revision" : "025bcb1165deab2e20d4eaba79967ce73013f496",
"version" : "1.2.1"
}
},
{
"identity" : "vapor",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/vapor.git",
"state" : {
"revision" : "288d73a368ac0d0e228dd9b81eecc576b50b9d6d",
"version" : "4.84.6"
"revision" : "8409c3c296e7f8965df14e906dbcd44eb68f54a9",
"version" : "4.92.6"
}
},
{
"identity" : "websocket-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/websocket-kit.git",
"state" : {
"revision" : "53fe0639a98903858d0196b699720decb42aee7b",
"version" : "2.14.0"
"revision" : "4232d34efa49f633ba61afde365d3896fc7f8740",
"version" : "2.15.0"
}
}
],
"version" : 2
"version" : 3
}
8 changes: 4 additions & 4 deletions bookstore-vapor/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.9
// swift-tools-version:5.10
import PackageDescription

let package = Package(
Expand All @@ -7,9 +7,9 @@ let package = Package(
.macOS(.v13)
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/fluent.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/fluent-postgres-driver.git", from: "2.0.0"),
.package(url: "https://github.com/vapor/vapor.git", exact: "4.92.6"),
.package(url: "https://github.com/vapor/fluent.git", exact: "4.9.0"),
.package(url: "https://github.com/vapor/fluent-postgres-driver.git", exact: "2.8.0"),
],
targets: [
.target(
Expand Down
19 changes: 12 additions & 7 deletions bookstore-vapor/Sources/Repository/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,26 @@ struct DatabaseConfiguration {
throw DatabaseConfigurationError.databaseNameMissing
}

self.port = Environment.get("DB_PORT").flatMap(Int.init(_:)) ?? PostgresConfiguration.ianaPortNumber
self.port = Environment.get("DB_PORT").flatMap(Int.init(_:)) ?? SQLPostgresConfiguration.ianaPortNumber
self.hostname = Environment.get("DB_HOST") ?? "db"
self.username = username
self.password = password
self.database = databaseName
}

var config: SQLPostgresConfiguration {
let tls: PostgresConnection.Configuration.TLS = .disable
return .init(hostname: hostname,
port: port,
username: username,
password: password,
database: database,
tls: tls)
}

static func setup(in app: Application) throws {
let dbConfig = try DatabaseConfiguration(app)
let factoryConfig: DatabaseConfigurationFactory = .postgres(hostname: dbConfig.hostname,
port: dbConfig.port,
username: dbConfig.username,
password: dbConfig.password,
database: dbConfig.database)

let factoryConfig: DatabaseConfigurationFactory = .postgres(configuration: dbConfig.config)
app.databases.use(factoryConfig, as: .psql)
}
}

0 comments on commit 337c7c8

Please sign in to comment.