Skip to content

Commit 6a0548e

Browse files
committed
fix: resolve build issues
1 parent 4a36102 commit 6a0548e

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

Sources/App/App.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ private let logger = Logger(label: "portfolio-server")
1010

1111
@main
1212
struct Portfolio: AsyncParsableCommand {
13-
@Option(name: .long)
14-
var env = AppEnv.development
15-
1613
@Option(name: .shortAndLong)
1714
var hostname = "127.0.0.1"
1815

@@ -26,7 +23,12 @@ struct Portfolio: AsyncParsableCommand {
2623
#endif
2724
} operation: {
2825
let app = self.buildApp()
29-
logger.info("Running server in '\(env.rawValue)' mode")
26+
#if DEBUG
27+
let buildMode = "development"
28+
#else
29+
let buildMode = "release"
30+
#endif
31+
logger.info("Running server in '\(buildMode)' mode")
3032
try await app.runService()
3133
}
3234
}

Sources/App/Middlewares/SiteMiddleware.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ struct SiteMiddleware<Context: RequestContext>: RouterController {
1919
LiveReloadMiddleware()
2020
#endif
2121

22-
if publicAssets.baseURL.isFileURL {
22+
if self.publicAssets.baseURL.isFileURL {
2323
FileMiddleware(
24-
publicAssets.baseURL.path(),
24+
self.publicAssets.baseURL.path(),
2525
searchForIndexHtml: false
2626
)
2727
}
@@ -36,11 +36,11 @@ struct SiteMiddleware<Context: RequestContext>: RouterController {
3636
case .home:
3737
return HomePage()
3838
case .api(.activity(.all)):
39-
do {
40-
return try JSONEncoder().encode(self.activityClient.activity(), from: req, context: ctx)
41-
} catch {
42-
throw HTTPError(.forbidden)
43-
}
39+
do {
40+
return try JSONEncoder().encode(self.activityClient.activity(), from: req, context: ctx)
41+
} catch {
42+
throw HTTPError(.forbidden)
43+
}
4444
case let .api(.activity(.location(location))):
4545
guard let auth = req.headers.authorization else {
4646
throw HTTPError(.notFound)
@@ -59,4 +59,4 @@ struct SiteMiddleware<Context: RequestContext>: RouterController {
5959
}
6060
}
6161
}
62-
}
62+
}

0 commit comments

Comments
 (0)