feat: Adds vault client

This commit is contained in:
2024-12-15 17:27:28 -05:00
parent 6d0108da0c
commit 601869d457
7 changed files with 344 additions and 25 deletions

View File

@@ -59,6 +59,16 @@ extension ConfigurationClient: DependencyKey {
public static var liveValue: Self {
.live(environment: ProcessInfo.processInfo.environment)
}
@_spi(Internal)
public static func mock(_ configuration: Configuration = .mock) -> Self {
.init(
find: { throw MockFindError() },
generate: Self().generate,
load: { _ in configuration },
write: Self().write
)
}
}
struct LiveConfigurationClient {
@@ -229,3 +239,5 @@ enum ConfigurationError: Error {
case decodingError
case fileExists(path: String)
}
struct MockFindError: Error {}

View File

@@ -1,3 +1,4 @@
import FileClient
import Foundation
/// Represents a file location and type on disk for a configuration file.
@@ -49,11 +50,3 @@ public enum File: Equatable, Sendable {
return .toml(fileUrl)
}
}
@_spi(Internal)
public extension URL {
var cleanFilePath: String {
absoluteString.replacing("file://", with: "")
}
}