This library simplifies retrieval of api keys when stored locally and on GitHub.
implementation 'com.andrewoid:apikeys:0.3'
ApiKey apiKey = new ApiKey();
String keyString = apiKey.get();
Make sure your .gitignore
includes this line
**/apikey.properties
Create a file src/main/resources/apikey.properties
in your project. This file must NOT be checked into git.
apikey=ApiKeyGivenToYouByTheApiWhenYouSignUp
-
Open your Repository on GitHub and go to
Settings
-
In
Secrets and Variables
add a new Repository Secret calledAPIKEY
. The value should be the API key that was given to you by the service.
Pass the API key as an environment variable to your .yaml
file as shown below.
env:
apikey: ${{ secrets.APIKEY }}