My Gradle build has a parameter
apiKey. When the build is run locally, this parameter should be read from a property in
When the build is run on a CI server, the property should instead be read from an environment variable named
How should I read this property in my build file? I’ve tried the following:
apiKey = System.getenv('apiKey')
But this seems to only look for the property in an environment variable, i.e. a property set in
gradle.properties is ignored.
How can I achieve the following?
- Get the
- If (1) fails, get
apiKeyfrom an environment variable