Renamed the Web package as Infrastructure (#24)
Reviewed-on: rock-n-code/loud-amsterdam#24 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit is contained in:
@@ -49,7 +49,7 @@ WORKDIR /build
|
||||
# a relative path, so its manifest must be present for resolution to succeed.
|
||||
COPY ./Packages/Localization/Package.swift ./Packages/Localization/
|
||||
COPY ./Packages/Persistence/Package.swift ./Packages/Persistence/
|
||||
COPY ./Packages/Web/Package.swift ./Packages/Web/
|
||||
COPY ./Packages/Infrastructure/Package.swift ./Packages/Infrastructure/
|
||||
COPY ./Services/Website/Package.swift ./Services/Website/Package.resolved ./Services/Website/
|
||||
RUN swift package --package-path ./Services/Website resolve
|
||||
|
||||
@@ -57,7 +57,7 @@ RUN swift package --package-path ./Services/Website resolve
|
||||
# in the assets stage and copied into staging after the binary is produced.
|
||||
COPY ./Packages/Localization/Sources ./Packages/Localization/Sources
|
||||
COPY ./Packages/Persistence/Sources ./Packages/Persistence/Sources
|
||||
COPY ./Packages/Web/Sources ./Packages/Web/Sources
|
||||
COPY ./Packages/Infrastructure/Sources ./Packages/Infrastructure/Sources
|
||||
COPY ./Services/Website/Sources ./Services/Website/Sources
|
||||
COPY ./Services/Website/Tests ./Services/Website/Tests
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ let package = Package(
|
||||
path: "../../Packages/Persistence"
|
||||
),
|
||||
.package(
|
||||
path: "../../Packages/Web"
|
||||
path: "../../Packages/Infrastructure"
|
||||
),
|
||||
.package(
|
||||
url: "https://github.com/elementary-swift/elementary.git",
|
||||
@@ -80,7 +80,7 @@ let package = Package(
|
||||
dependencies: [
|
||||
.byName(name: "Localization"),
|
||||
.byName(name: "Persistence"),
|
||||
.byName(name: "Web"),
|
||||
.byName(name: "Infrastructure"),
|
||||
.product(
|
||||
name: "Configuration",
|
||||
package: "swift-configuration"
|
||||
@@ -120,7 +120,7 @@ let package = Package(
|
||||
name: "WebsiteLibraryTests",
|
||||
dependencies: [
|
||||
.byName(name: "Persistence"),
|
||||
.byName(name: "Web"),
|
||||
.byName(name: "Infrastructure"),
|
||||
.byName(name: "WebsiteLibrary"),
|
||||
.product(
|
||||
name: "Elementary",
|
||||
|
||||
@@ -26,7 +26,7 @@ Two SwiftPM targets:
|
||||
|
||||
The `Website` executable depends on three local packages:
|
||||
- `Localization` (`Packages/Localization`) — the `Localize` and `Negotiate` helpers and the `LanguageList` of catalog languages (used by `WebsiteLibrary`).
|
||||
- `Web` (`Packages/Web`) — the `RouterController` protocol the controllers conform to and the `addController` result-builder extension that registers their routes on the router declaratively.
|
||||
- `Infrastructure` (`Packages/Infrastructure`) — the `RouterController` protocol the controllers conform to and the `addController` result-builder extension that registers their routes on the router declaratively.
|
||||
- `Persistence` (`Packages/Persistence`) — the Fluent-based data layer: the `Driver` selector, the `Service` factory that builds the `Fluent` service, the `PrepareDB` registrar that declares the migrations, and the `Probe` consulted by the readiness check; the models, migrations, and repositories stay internal to the package. It has no dependency on `swift-configuration`; the executable maps the `database.*` keys onto the driver.
|
||||
|
||||
The persistence backend runs as a `Fluent` service inside the application's ServiceLifecycle group, so it starts and stops alongside the HTTP server (which owns its connection-pool shutdown on graceful termination).
|
||||
|
||||
@@ -3,7 +3,7 @@ import Hummingbird
|
||||
import HummingbirdCompression
|
||||
import Logging
|
||||
import Persistence
|
||||
import Web
|
||||
import Infrastructure
|
||||
import WebsiteLibrary
|
||||
|
||||
/// Builds the website application.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Hummingbird
|
||||
import NIOCore
|
||||
import Persistence
|
||||
import Web
|
||||
import Infrastructure
|
||||
|
||||
/// Serves the website's health-check routes.
|
||||
///
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Hummingbird
|
||||
import Web
|
||||
import Infrastructure
|
||||
|
||||
/// Serves the website's root routes.
|
||||
///
|
||||
|
||||
@@ -48,22 +48,6 @@ struct AppTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func `landing page to answer a head request`() async throws {
|
||||
try await app(
|
||||
staticFilesPath: staticFilesPath
|
||||
).test(.router) { client in
|
||||
try await client.execute(
|
||||
uri: "/",
|
||||
method: .head
|
||||
) { response in
|
||||
#expect(response.status == .ok)
|
||||
#expect(response.headers[.contentType] == "text/html; charset=utf-8")
|
||||
#expect(response.body.readableBytes == 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func `health check to be served at the health path`() async throws {
|
||||
try await app(
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
},
|
||||
{
|
||||
"target" : {
|
||||
"containerPath" : "container:..\/..\/Packages\/Web",
|
||||
"identifier" : "WebTests",
|
||||
"name" : "WebTests"
|
||||
"containerPath" : "container:..\/..\/Packages\/Infrastructure",
|
||||
"identifier" : "InfrastructureTests",
|
||||
"name" : "InfrastructureTests"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user