You cannot now use environment variables inside the prefire.yml configuration file. This often resulted in an inability to flexibly configure. I decided to add a simple support for this.
Implementation 👩💻👨💻
I get the data from ProcessInfo.processInfo.environment.
Then using a simple search I replace env with data from ProcessInfo:
if let key = value?.findKey(), let envValue = env[key] {
value = value?.replacingOccurrences(of: "${\(key)}", with: envValue)
}
func findKey() -> String? {
guard contains("${") else { return nil }
return components(separatedBy: "${").last?.components(separatedBy: "}").first
}
It's not the fastest solution, but you can speed it up in the future by using index lookup.
Short description 📝
Support for environment parameters in
prefire.yml
Solution 📦
You cannot now use environment variables inside the
prefire.yml
configuration file. This often resulted in an inability to flexibly configure. I decided to add a simple support for this.Implementation 👩💻👨💻
I get the data from
ProcessInfo.processInfo.environment
. Then using a simple search I replace env with data fromProcessInfo
:It's not the fastest solution, but you can speed it up in the future by using index lookup.