Allow log path specification
This commit is contained in:
@ -33,6 +33,22 @@ struct Configuration {
|
||||
|
||||
/// The authentication tokens to access the metrics
|
||||
let monitoringTokens: Set<String>
|
||||
|
||||
/// The path to the folder where the metric logs are stored
|
||||
///
|
||||
/// If no path is provided, then a folder `logs` in the resources directory is created
|
||||
/// If the path is relative, then it is assumed relative to the resources directory
|
||||
let logPath: String?
|
||||
|
||||
func logURL(possiblyRelativeTo resourcesDirectory: URL) -> URL {
|
||||
guard let logPath else {
|
||||
return resourcesDirectory.appendingPathComponent("logs")
|
||||
}
|
||||
guard !logPath.hasPrefix("/") else {
|
||||
return .init(fileURLWithPath: logPath)
|
||||
}
|
||||
return resourcesDirectory.appendingPathComponent(logPath)
|
||||
}
|
||||
}
|
||||
|
||||
extension Configuration {
|
||||
|
Reference in New Issue
Block a user