Skip to main content

Environment Management Quick Reference

Quick Commands​

Environment Switching​

# Switch to staging
firebase use staging

# Switch to production
firebase use production

# Check current environment
firebase use

Deployment​

# Deploy to staging
./deploy-staging.ps1

# Deploy to production
./deploy-production.ps1

# Manual deployment
firebase deploy --only apphosting --project toto-bo-stg # Staging
firebase deploy --only apphosting --project toto-bo # Production

Secret Management​

# Create new staging secret
gcloud secrets create secret-name --project=toto-bo-stg

# Grant access to App Hosting
firebase apphosting:secrets:grantaccess secret-name --backend toto-bo-stg --project toto-bo-stg

# Add secret value
echo "secret-value" | gcloud secrets versions add secret-name --data-file=- --project=toto-bo-stg

πŸ“‹ Environment URLs​

Production​

  • Backoffice: https://bo.betoto.pet
  • Main App: https://app.betoto.pet
  • Wallet: https://us-central1-toto-wallet-76e93.cloudfunctions.net

Staging​

  • Backoffice: https://stg.bo.betoto.pet
  • Main App: https://stg.app.betoto.pet
  • Wallet: https://us-central1-toto-wallet-stg.cloudfunctions.net

πŸ” Key Secrets​

Staging (toto-bo-stg)​

  • stg-firebase-main-private-key
  • stg-firebase-bo-private-key
  • stg-sendgrid-api-key

Production (toto-bo)​

  • bo-firebase-main-private-key
  • bo-firebase-bo-private-key
  • bo-sendgrid-api-key

πŸ“Š Configuration Files​

  • Staging: apphosting.stg.yaml
  • Production: apphosting.prod.yaml
  • Documentation: ENVIRONMENTS.md

🎯 Workflow​

  1. Develop β†’ Local testing
  2. Stage β†’ Push to staging branch
  3. Test β†’ Validate in staging environment
  4. Deploy β†’ Merge to main branch

🚨 Important Notes​

  • βœ… Always test in staging before production
  • βœ… Use firebase use to verify environment
  • βœ… Staging and production are completely isolated
  • βœ… Never share secrets between environments