diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0c04c53 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cmake.configureOnOpen": false +} diff --git a/Package.resolved b/Package.resolved index 3e7ab6b..9583865 100644 --- a/Package.resolved +++ b/Package.resolved @@ -33,8 +33,8 @@ "repositoryURL": "https://github.com/vapor/fluent.git", "state": { "branch": null, - "revision": "2da106f46b093885f77fa03e3c719ab5bb8cfab4", - "version": "4.6.0" + "revision": "4b4d8bf15a06fd60137e9c543e5503c4b842654e", + "version": "4.8.0" } }, { @@ -42,8 +42,8 @@ "repositoryURL": "https://github.com/vapor/fluent-kit.git", "state": { "branch": null, - "revision": "be7912ee4991bcc8a5390fac0424d1d08221dcc6", - "version": "1.36.1" + "revision": "21d99b0c66cf86867a779bac831d800aac22f5e6", + "version": "1.41.0" } }, { @@ -69,8 +69,8 @@ "repositoryURL": "https://github.com/vapor/sql-kit.git", "state": { "branch": null, - "revision": "d2027b4b81a19d2ac7bd01936e7a778d7f0afa02", - "version": "3.15.0" + "revision": "fcc29f543b3de7b661cbe7540805974234cb9740", + "version": "3.24.0" } }, { @@ -123,8 +123,8 @@ "repositoryURL": "https://github.com/apple/swift-log.git", "state": { "branch": null, - "revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", - "version": "1.4.2" + "revision": "32e8d724467f8fe623624570367e3d50c5638e46", + "version": "1.5.2" } }, { @@ -195,8 +195,8 @@ "repositoryURL": "https://github.com/vapor/vapor.git", "state": { "branch": null, - "revision": "7b76fe01a8eb02aa7f61d9ca10624f98b25a5735", - "version": "4.69.2" + "revision": "9a340de4995e5a9dade4ff4c51cd2e6ae30c12d6", + "version": "4.77.0" } }, { diff --git a/Package.swift b/Package.swift index ab69278..d635532 100644 --- a/Package.swift +++ b/Package.swift @@ -14,7 +14,7 @@ let package = Package( ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/vapor/vapor.git", from: "4.76.2"), + .package(url: "https://github.com/vapor/vapor.git", from: "4.77.0"), .package(url: "https://github.com/vapor/fluent.git", from: "4.8.0") ], targets: [ diff --git a/Sources/YData/Core/Configuration/Configuration.swift b/Sources/YData/Core/Configuration/Configuration.swift index 4088be6..4e35d31 100644 --- a/Sources/YData/Core/Configuration/Configuration.swift +++ b/Sources/YData/Core/Configuration/Configuration.swift @@ -6,11 +6,17 @@ public protocol Configuration { associatedtype Error: ConfigurationError static func loadFromEnvironment() -> Result - static func loadFromEnvironment() throws -> Self + + static func loadFromEnvironment(context: C) -> Result + static func loadFromEnvironment(context: C) throws -> Self } public extension Configuration { + static func loadFromEnvironment() -> Result { + return .failure(NotImplementedError() as! Self.Error) + } + static func loadFromEnvironment() throws -> Self { let result: Result = loadFromEnvironment() switch result { @@ -18,4 +24,14 @@ public extension Configuration { case .failure(let error): throw error } } + + static func loadFromEnvironment(context: C) -> Result { + loadFromEnvironment() + } + + static func loadFromEnvironment(context: C) throws -> Self { + try loadFromEnvironment() + } } + +public struct NotImplementedError: ConfigurationError {} diff --git a/Sources/YData/Core/Context/Context.swift b/Sources/YData/Core/Context/Context.swift new file mode 100644 index 0000000..4dfb822 --- /dev/null +++ b/Sources/YData/Core/Context/Context.swift @@ -0,0 +1,3 @@ +import Foundation + +public protocol Context {} diff --git a/Sources/YData/Core/Context/EventLoopContext.swift b/Sources/YData/Core/Context/EventLoopContext.swift index d8a70f8..96304f9 100644 --- a/Sources/YData/Core/Context/EventLoopContext.swift +++ b/Sources/YData/Core/Context/EventLoopContext.swift @@ -1,6 +1,6 @@ import Foundation import protocol NIO.EventLoop -public protocol EventLoopContext { +public protocol EventLoopContext: Context { var eventLoop: EventLoop { get } } diff --git a/Sources/YData/Core/Context/LoggerContext.swift b/Sources/YData/Core/Context/LoggerContext.swift index baa1245..6f45f7f 100644 --- a/Sources/YData/Core/Context/LoggerContext.swift +++ b/Sources/YData/Core/Context/LoggerContext.swift @@ -1,6 +1,6 @@ import Foundation import Vapor -public protocol LoggerContext { +public protocol LoggerContext: Context { var logger: Logger { get } }