I want to open source my iOS app but still be able to build it using a CI system like Microsoft App Center. My app uses private API keys that I want to hide from my open source repository.
Fortunately App Center offers the environment variables feature, which are intended to use at build time. Their documentation says they can be used like this in bash:
$ENVIRONMENT_VARIABLE
So, say I have an environment variable called GoogleAPIKey configured in App Center, can I retrieve it like this ProcessInfo.processInfo.environment["GoogleAPIKey"] ?? ""
in my app? If yes, how do I test the app on my device if only App Center has the key (I don't want to put it in my code since that would mean it would be public (do I need to use gitignore
)?