File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 1414
1515import Fluent
1616import FluentPostgresDriver
17+ import Redis
1718import Vapor
1819
20+
1921@discardableResult
2022public func configure( _ app: Application ) async throws -> String {
2123 #if DEBUG && os(macOS)
@@ -49,6 +51,7 @@ public func configure(_ app: Application) async throws -> String {
4951 // This parameter could also be made configurable via an env variable.
5052 let maxConnectionsPerEventLoop = 3
5153
54+ // Setup database connection
5255 guard
5356 let host = Environment . get ( " DATABASE_HOST " ) ,
5457 let port = Environment . get ( " DATABASE_PORT " ) . flatMap ( Int . init) ,
@@ -75,6 +78,13 @@ public func configure(_ app: Application) async throws -> String {
7578 sqlLogLevel: . debug) ,
7679 as: . psql)
7780
81+ // Setup Redis connection
82+ do {
83+ app. redis. configuration = try RedisConfiguration ( hostname: " redis " )
84+ } catch {
85+ app. logger. warning ( " Failed to configure Redis, caching disabled. Error: \( error) " )
86+ }
87+
7888 do { // Migration 001 - schema 1.0
7989 app. migrations. add ( CreatePackage ( ) )
8090 app. migrations. add ( CreateRepository ( ) )
You can’t perform that action at this time.
0 commit comments