Caps-Train/Sources/Configuration.swift

23 lines
424 B
Swift
Raw Normal View History

2023-10-23 12:28:35 +02:00
import Foundation
2023-10-23 14:58:58 +02:00
struct Configuration {
2023-10-23 12:28:35 +02:00
let contentFolder: String
2023-10-23 14:58:58 +02:00
2023-10-23 12:28:35 +02:00
let trainingIterations: Int
let serverPath: String
let authenticationToken: String
2023-10-23 14:58:58 +02:00
}
extension Configuration {
2023-10-23 12:28:35 +02:00
func serverUrl() throws -> URL {
guard let serverUrl = URL(string: serverPath) else {
2023-10-23 16:49:56 +02:00
throw TrainingError.invalidServerPath(serverPath)
2023-10-23 12:28:35 +02:00
}
return serverUrl
}
}