diff --git a/.env b/.env index 50988a3..1dbbdd7 100644 --- a/.env +++ b/.env @@ -3,7 +3,7 @@ FLASK_SECRET_KEY=replace-with-long-random-string # Firebase Admin (choose ONE of these approaches) # 1) Path to JSON creds file -GOOGLE_APPLICATION_CREDENTIALS=./rothbard-service-account.json +GOOGLE_APPLICATION_CREDENTIALS=./rothbard-staging2-12345-firebase-adminsdk-fbsvc-7f95268383.json # 2) Or inline JSON (escaped as single line) # FIREBASE_SERVICE_ACCOUNT_JSON={"type":"service_account",...} @@ -15,7 +15,8 @@ FILEVINE_ORG_ID=9227 FILEVINE_USER_ID=100510 # Front-end Firebase (public — safe to expose) -FIREBASE_API_KEY=AIzaSyC7t2D0uSuc1hm6ZEkfUMVPtkaE2TXF1a0 -FIREBASE_AUTH_DOMAIN=rothbard-3f496.firebaseapp.com -FIREBASE_PROJECT_ID=rothbard-3f496 -FIREBASE_APP_ID=1:90016977941:web:da38d57849021115e52a1c +FIREBASE_API_KEY=AIzaSyB4pblbfM4YIs37xTHbWyUkyXWNfuWnefI +FIREBASE_AUTH_DOMAIN=rothbard-staging2-12345.firebaseapp.com +FIREBASE_PROJECT_ID=rothbard-staging2-12345 +FIREBASE_APP_ID=1:695441955489:web:bbee4153fe0994c5c72ee0 +FIRESTORE_DB=rothbard-staging2 diff --git a/firestore.rules b/firestore.rules new file mode 100644 index 0000000..18cdb05 --- /dev/null +++ b/firestore.rules @@ -0,0 +1,14 @@ +rules_version = '2'; +service cloud.firestore { + match /databases/{database}/documents { + // Allow read/write access to user's own settings + match /users/{userId} { + allow read, write: if request.auth != null && request.auth.uid == userId; + } + + // Deny access to all other documents + match /{document=**} { + allow read, write: if false; + } + } +} \ No newline at end of file diff --git a/main.tf b/main.tf index 9e7cf79..6caf663 100644 --- a/main.tf +++ b/main.tf @@ -2,7 +2,7 @@ provider "google" { project = var.project_id billing_project = var.project_id - region = var.region + region = var.region user_project_override = true } @@ -79,7 +79,7 @@ resource "google_firebase_web_app" "main_app" { resource "google_firestore_database" "main_firestore" { provider = google-beta project = google_project.main_project.project_id - name = "${google_project.main_project.name}" + name = "(default)" location_id = var.region type = "FIRESTORE_NATIVE" concurrency_mode = "OPTIMISTIC" @@ -136,6 +136,33 @@ resource "google_identity_platform_config" "main_config" { depends_on = [google_project_service.auth_service] } +resource "google_firebaserules_ruleset" "primary" { + source { + files { + content = <