Files
swift-hpa/Sources/ConfigurationClient/Constants.swift

30 lines
756 B
Swift

@_spi(Internal)
public enum EnvironmentKey {
static let xdgConfigHome = "XDG_CONFIG_HOME"
static let hpaConfigHome = "HPA_CONFIG_HOME"
static let hpaConfigFile = "HPA_CONFIG_FILE"
}
@_spi(Internal)
public enum HPAKey {
public static let configDirName = "hpa"
public static let resourceFileName = "hpa"
public static let resourceFileExtension = "toml"
public static let defaultFileName = "config.toml"
public static let defaultFileNameWithoutExtension = "config.toml"
}
extension [String: String] {
var xdgConfigHome: String {
self[EnvironmentKey.xdgConfigHome] ?? "~/.config"
}
var hpaConfigHome: String? {
self[EnvironmentKey.hpaConfigHome]
}
var hpaConfigFile: String? {
self[EnvironmentKey.hpaConfigFile]
}
}