Difference between revisions of "Vapor"
From Coder Merlin
(One intermediate revision by one other user not shown) | |||
Line 7: | Line 7: | ||
<syntaxhighlight lang="swift"> | <syntaxhighlight lang="swift"> | ||
// Set local port | // Set local port | ||
guard let portString = Environment.get(" | guard let portString = Environment.get("VAPOR_LOCAL_PORT"), | ||
let port = Int(portString) else { | |||
fatalError("Failed to determine VAPOR LOCAL PORT from environment") | |||
fatalError(" | |||
} | } | ||
app.http.server.configuration.port = port | app.http.server.configuration.port = port | ||
// Set local host | // Set local host | ||
guard let hostname = Environment.get(" | guard let hostname = Environment.get("VAPOR_LOCAL_HOST") else { | ||
fatalError("Failed to determine | fatalError("Failed to determine VAPOR LOCAL HOST from environment") | ||
} | } | ||
app.http.server.configuration.hostname = hostname | app.http.server.configuration.hostname = hostname | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 16:22, 10 June 2021
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
References[edit]
Fluent[edit]
- Getting Started with Fluent (TheSwiftDev)
Configuration[edit]
In the path: ./Sources/App/configure.swift:
// Set local port
guard let portString = Environment.get("VAPOR_LOCAL_PORT"),
let port = Int(portString) else {
fatalError("Failed to determine VAPOR LOCAL PORT from environment")
}
app.http.server.configuration.port = port
// Set local host
guard let hostname = Environment.get("VAPOR_LOCAL_HOST") else {
fatalError("Failed to determine VAPOR LOCAL HOST from environment")
}
app.http.server.configuration.hostname = hostname