Caps-Train/Sources/Configuration.swift

24 lines
490 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 {
print("[ERROR] Configuration: Invalid server path \(serverPath)")
throw TrainingError.invalidServerPath
}
return serverUrl
}
}