From e6fad99c948ab3051d741edfea31b3e3da826a3c Mon Sep 17 00:00:00 2001 From: charlie mangano Date: Sun, 10 Nov 2024 19:43:35 +0100 Subject: [PATCH] refactor: rename `apikey.defaults.properties` to `secrets.defaults.properties` for consistency --- .github/workflows/AndroidBuild.yml | 16 ++++++++-------- .gitignore | 2 +- apikeys.defaults.properties | 8 -------- app/build.gradle.kts | 20 ++++++++++---------- secrets.defaults.properties | 8 ++++++++ 5 files changed, 27 insertions(+), 27 deletions(-) delete mode 100644 apikeys.defaults.properties create mode 100644 secrets.defaults.properties diff --git a/.github/workflows/AndroidBuild.yml b/.github/workflows/AndroidBuild.yml index 56118a07a..21816f9e0 100644 --- a/.github/workflows/AndroidBuild.yml +++ b/.github/workflows/AndroidBuild.yml @@ -23,20 +23,20 @@ jobs: run: | chmod +x ./gradlew - - name: Setup apikeys.properties + - name: Setup secrets.properties env: SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }} SERVICE_KEY: ${{ secrets.SERVICE_KEY }} SUPABASE_URL: ${{ secrets.SUPABASE_URL }} POWERSYNC_URL: ${{ secrets.POWERSYNC_URL }} - TEST: "TEST" + TEST: "TEST_CI_VALUE" run: | - # sed "s|SUPABASE_KEY|$SUPABASE_KEY|g;" apikeys.defaults.properties > apikeys.properties - # sed "s|SERVICE_KEY|SERVICE_KEY|g;" apikeys.defaults.properties > apikeys.properties - # sed "s|SUPABASE_URL|SUPABASE_URL|g;" apikeys.defaults.properties > apikeys.properties - # sed "s|POWERSYNC_URL|POWERSYNC_URL|g;" apikeys.defaults.properties > apikeys.properties - sed "s|TEST|TEST|g;" apikeys.defaults.properties > apikeys.properties - cat apikeys.properties + # sed "s|SUPABASE_KEY|$SUPABASE_KEY|g;" secrets.defaults.properties > secrets.properties + # sed "s|SERVICE_KEY|SERVICE_KEY|g;" secrets.defaults.properties > secrets.properties + # sed "s|SUPABASE_URL|SUPABASE_URL|g;" secrets.defaults.properties > secrets.properties + # sed "s|POWERSYNC_URL|POWERSYNC_URL|g;" secrets.defaults.properties > secrets.properties + sed "s|TEST|TEST|g;" apikeys.defaults.properties > secrets.properties + cat secrets.properties - name: Build with Gradle diff --git a/.gitignore b/.gitignore index f6de07b83..1dea50d91 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ .DS_Store .gradle /local.properties -/apikeys.properties +/secrets.properties /build /captures .externalNativeBuild diff --git a/apikeys.defaults.properties b/apikeys.defaults.properties deleted file mode 100644 index fee2df6bf..000000000 --- a/apikeys.defaults.properties +++ /dev/null @@ -1,8 +0,0 @@ -# This file serves as a template for the apikeys.properties file. -# It should be checked into Version Control Systems to provide a structure for the required API keys and client URLs. -# The actual values should be filled in by the CI pipeline using the secrets Gradle plugin and GitHub Secrets. -POWERSYNC_URL= -SUPABASE_KEY= -SERVICE_KEY= -SUPABASE_URL= -TEST= \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8b816d88d..34ae42b31 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -17,16 +17,16 @@ android { namespace = "com.android.periodpals" compileSdk = 34 - // // Load the API key from apikeys.properties - // val apikeysProperties = Properties() - // val localPropertiesFile = rootProject.file("apikeys.properties") + // // Load the API key from secrets.properties + // val secretsProperties = Properties() + // val localPropertiesFile = rootProject.file("secrets.properties") // if (localPropertiesFile.exists()) { - // apikeysProperties.load(FileInputStream(localPropertiesFile)) + // secretsProperties.load(FileInputStream(localPropertiesFile)) // } - // val supabaseUrl = apikeysProperties.getProperty("SUPABASE_URL") ?: "couldnt get property" - // val supabaseKey = apikeysProperties.getProperty("SUPABASE_KEY") ?: "couldnt get property" - // val powersyncUrl = apikeysProperties.getProperty("POWERSYNC_URL") ?: "couldnt get property" - // val serviceKey = apikeysProperties.getProperty("SERVICE_KEY") ?: "couldnt get property" + // val supabaseUrl = secretsProperties.getProperty("SUPABASE_URL") ?: "couldnt get property" + // val supabaseKey = secretsProperties.getProperty("SUPABASE_KEY") ?: "couldnt get property" + // val powersyncUrl = secretsProperties.getProperty("POWERSYNC_URL") ?: "couldnt get property" + // val serviceKey = secretsProperties.getProperty("SERVICE_KEY") ?: "couldnt get property" defaultConfig { applicationId = "com.android.periodpals" @@ -249,8 +249,8 @@ dependencies { } secrets { - propertiesFileName = "apikeys.properties" - defaultPropertiesFileName = "apikeys.defaults.properties" + propertiesFileName = "secrets.properties" + defaultPropertiesFileName = "secrets.defaults.properties" } tasks.withType { diff --git a/secrets.defaults.properties b/secrets.defaults.properties new file mode 100644 index 000000000..d62432d97 --- /dev/null +++ b/secrets.defaults.properties @@ -0,0 +1,8 @@ +# This file serves as a template for the secrets.properties file. +# It should be checked into Version Control Systems to provide a structure for the required API keys and client URLs. +# The actual values should be filled in by the CI pipeline using the secrets Gradle plugin and GitHub Secrets. +POWERSYNC_URL=SAFE_DEFAULT_VALUE_POWERSYNC_URL +SUPABASE_KEY=SAFE_DEFAULT_VALUE_SUPABASE_KEY +SERVICE_KEY=SAFE_DEFAULT_VALUE_SERVICE_KEY +SUPABASE_URL=SAFE_DEFAULT_VALUE_SUPABASE_URL +TEST=TEST_DEFAULT_VALUE \ No newline at end of file