2022-05-22 23:24:04 +02:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
struct Config: Codable {
|
|
|
|
|
2022-05-27 09:25:41 +02:00
|
|
|
/// The path to the log file
|
2022-05-22 23:24:04 +02:00
|
|
|
let logPath: String
|
|
|
|
|
2022-05-27 09:25:41 +02:00
|
|
|
/// Serve files in the Public directory using Vapor
|
2022-05-22 23:24:04 +02:00
|
|
|
let serveFiles: Bool
|
|
|
|
|
2022-05-27 09:25:41 +02:00
|
|
|
/// Authentication tokens for remotes allowed to write
|
|
|
|
let writers: [String]
|
|
|
|
|
2022-05-22 23:24:04 +02:00
|
|
|
var logURL: URL {
|
|
|
|
.init(fileURLWithPath: logPath)
|
|
|
|
}
|
|
|
|
|
|
|
|
static var `default`: Config {
|
2022-05-27 09:25:41 +02:00
|
|
|
.init(logPath: "/var/log/caps.log", serveFiles: true, writers: [])
|
2022-05-22 23:24:04 +02:00
|
|
|
}
|
|
|
|
}
|