Skip to content

Commit

Permalink
feat: load Supabase URL and key from local.properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Harrish92 committed Oct 17, 2024
1 parent 0da6d62 commit 84e3de1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables { useSupportLibrary = true }

val properties = Properties()
properties.load(project.rootProject.file("local.properties").inputStream())
buildConfigField("String", "SUPABASE_KEY", properties.getProperty("SUPABASE_KEY"))
buildConfigField("String", "SUPABASE_URL", properties.getProperty("SUPABASE_URL"))


}

Expand Down Expand Up @@ -60,6 +65,7 @@ android {

buildFeatures {
compose = true
buildConfig = true
}

composeOptions { kotlinCompilerExtensionVersion = "1.5.1" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.android.periodpals.model.user

import com.android.periodpals.BuildConfig.SUPABASE_KEY
import com.android.periodpals.BuildConfig.SUPABASE_URL
import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.annotations.SupabaseInternal
import io.github.jan.supabase.createSupabaseClient
import io.github.jan.supabase.postgrest.Postgrest
import io.github.jan.supabase.postgrest.postgrest
Expand Down Expand Up @@ -37,9 +40,11 @@ class UserRepositorySupabase : UserRepository {
}
}

@OptIn(SupabaseInternal::class)
private fun getClient(): SupabaseClient {
return createSupabaseClient(
supabaseUrl = "", supabaseKey = "") // Supabase URL and Key are not provided
supabaseUrl = SUPABASE_URL,
supabaseKey = SUPABASE_KEY)
{
install(Postgrest)
}
Expand Down

0 comments on commit 84e3de1

Please sign in to comment.