Skip to content

Commit

Permalink
pass in API key using root-level local.properties
Browse files Browse the repository at this point in the history
  • Loading branch information
aarsilv committed Apr 9, 2024
1 parent 774d935 commit 0a4c254
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ plugins {
id 'com.android.application'
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localProperties.load(new FileInputStream(localPropertiesFile))
}

android {
compileSdk 33

Expand All @@ -14,6 +20,8 @@ android {
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

buildConfigField "String", "API_KEY", "\"" + (localProperties['cloud.eppo.apiKey'] ?: "need to set cloud.eppo.apiKey in local.properties") + "\""
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

import cloud.eppo.android.EppoClient;
import cloud.eppo.android.InitializationCallback;
import com.geteppo.androidexample.BuildConfig;

public class EppoApplication extends Application {
private static final String TAG = EppoApplication.class.getSimpleName();
private static final String API_KEY = "DAXlGwLoDFYSskIUEDbyESt9lh8_1wG2uDMo9jvJo4I";
private static final String API_KEY = BuildConfig.API_KEY; // Set in root-level local.properties

@Override
public void onCreate() {
Expand Down

0 comments on commit 0a4c254

Please sign in to comment.