File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,6 @@ private let logger = Logger(label: "portfolio-server")
10
10
11
11
@main
12
12
struct Portfolio : AsyncParsableCommand {
13
- @Option ( name: . long)
14
- var env = AppEnv . development
15
-
16
13
@Option ( name: . shortAndLong)
17
14
var hostname = " 127.0.0.1 "
18
15
@@ -26,7 +23,12 @@ struct Portfolio: AsyncParsableCommand {
26
23
#endif
27
24
} operation: {
28
25
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 " )
30
32
try await app. runService ( )
31
33
}
32
34
}
Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ struct SiteMiddleware<Context: RequestContext>: RouterController {
19
19
LiveReloadMiddleware ( )
20
20
#endif
21
21
22
- if publicAssets. baseURL. isFileURL {
22
+ if self . publicAssets. baseURL. isFileURL {
23
23
FileMiddleware (
24
- publicAssets. baseURL. path ( ) ,
24
+ self . publicAssets. baseURL. path ( ) ,
25
25
searchForIndexHtml: false
26
26
)
27
27
}
@@ -36,11 +36,11 @@ struct SiteMiddleware<Context: RequestContext>: RouterController {
36
36
case . home:
37
37
return HomePage ( )
38
38
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
+ }
44
44
case let . api( . activity( . location( location) ) ) :
45
45
guard let auth = req. headers. authorization else {
46
46
throw HTTPError ( . notFound)
@@ -59,4 +59,4 @@ struct SiteMiddleware<Context: RequestContext>: RouterController {
59
59
}
60
60
}
61
61
}
62
- }
62
+ }
You can’t perform that action at this time.
0 commit comments