Difference between revisions of "Vapor"

From Coder Merlin
(Created page with "== Configuration == In the path: {{Pathname|./Sources/App/configure.swift}}: <syntaxhighlight lang="swift"> // Set local port guard let portString = Environment.get("IGIS_LOC...")
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== References ==
=== Fluent ===
* [https://theswiftdev.com/get-started-with-the-fluent-orm-framework-in-vapor-4/ Getting Started with Fluent] (TheSwiftDev)
== Configuration ==
== Configuration ==
In the path: {{Pathname|./Sources/App/configure.swift}}:
In the path: {{Pathname|./Sources/App/configure.swift}}:
Line 4: Line 7:
<syntaxhighlight lang="swift">
<syntaxhighlight lang="swift">
// Set local port
// Set local port
guard let portString = Environment.get("IGIS_LOCAL_PORT") else {
guard let portString = Environment.get("VAPOR_LOCAL_PORT"),
    fatalError("Failed to determine IGIS LOCAL PORT from environment")
      let port = Int(portString) else {
}
     fatalError("Failed to determine VAPOR LOCAL PORT from environment")
guard let port = Int(portString) else {
     fatalError("Malformed IGIS LOCAL PORT: \(portString)")
}
}
app.http.server.configuration.port = port
app.http.server.configuration.port = port


// Set local host
// Set local host
guard let hostname = Environment.get("IGIS_LOCAL_HOST") else {
guard let hostname = Environment.get("VAPOR_LOCAL_HOST") else {
     fatalError("Failed to determine IGIS LOCAL HOST from environment")
     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]

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