Allow custom data folder

This commit is contained in:
Christoph Hagen
2023-12-25 18:46:05 +01:00
parent 32055ecdec
commit 10194066db
3 changed files with 20 additions and 3 deletions

View File

@ -23,6 +23,13 @@ struct Configuration {
/// The number of minutes until a password reset token is no longer valid
let tokenExpiryDuration: Int
}
/**
The folder where the data should be stored.
If the folder is set to `nil`, then the `Resources` folder is used.
*/
let dataDirectory: String?
/// The authentication tokens to access the metrics
let monitoringTokens: Set<String>
@ -42,6 +49,13 @@ struct Configuration {
}
return resourcesDirectory.appendingPathComponent(logPath)
}
func customDataDirectory(or publicDirectory: String) -> URL {
guard let dataDirectory else {
return URL(fileURLWithPath: publicDirectory)
}
return URL(fileURLWithPath: dataDirectory)
}
}
extension Configuration {