Skip to content

Commit

Permalink
refactor: rename apikey.defaults.properties to `secrets.defaults.pr…
Browse files Browse the repository at this point in the history
…operties` for consistency
  • Loading branch information
charliemangano committed Nov 10, 2024
1 parent ffd91d7 commit e6fad99
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/AndroidBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.DS_Store
.gradle
/local.properties
/apikeys.properties
/secrets.properties
/build
/captures
.externalNativeBuild
Expand Down
8 changes: 0 additions & 8 deletions apikeys.defaults.properties

This file was deleted.

20 changes: 10 additions & 10 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -249,8 +249,8 @@ dependencies {
}

secrets {
propertiesFileName = "apikeys.properties"
defaultPropertiesFileName = "apikeys.defaults.properties"
propertiesFileName = "secrets.properties"
defaultPropertiesFileName = "secrets.defaults.properties"
}

tasks.withType<Test> {
Expand Down
8 changes: 8 additions & 0 deletions secrets.defaults.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e6fad99

Please sign in to comment.