Skip to content

Adding Region Pages Cloud Connector Access#205

Open
evanpetzoldt wants to merge 3 commits intodevfrom
feat-cloud-connector-enablement
Open

Adding Region Pages Cloud Connector Access#205
evanpetzoldt wants to merge 3 commits intodevfrom
feat-cloud-connector-enablement

Conversation

@evanpetzoldt
Copy link
Copy Markdown
Collaborator

This pull request adds support for connecting to the F3 Data Warehouse using the Google Cloud SQL Node.js Connector, making it possible to use secure, authenticated connections without exposing a public IP. The changes introduce new environment variables and update the database connection logic to support both direct and connector-based modes. Several scripts and configuration files are updated to use the new connection method.

👋 TL;DR

Adding another way to connect to the F3 SQL db after we locked down IP access.

🔎 Details

Cloud SQL Connector integration:

  • Added the @google-cloud/cloud-sql-connector dependency and related configuration to package.json and pnpm-lock.yaml. [1] [2]
  • Updated .env.local.sample and apphosting.yaml to include new environment variables for Cloud SQL Connector configuration (e.g., WAREHOUSE_DB_CONNECTION_MODE, CLOUD_SQL_WAREHOUSE_CONNECTION_NAME, WAREHOUSE_DB_USER, etc.). [1] [2]

Database connection logic:

  • Refactored drizzle/f3-data-warehouse/db.ts to support both direct and Cloud SQL Connector connection modes, with connection pooling, lazy initialization, and a new close() method for cleanup.
  • Updated src/lib/env.ts to only require F3_DATA_WAREHOUSE_URL when in direct connection mode.

Script updates:

  • Updated all scripts (prune-regions.ts, prune-workouts.ts, seed-regions.ts, seed-workouts.ts) to use the new getDb async function for obtaining a database instance, ensuring compatibility with both connection modes. [1] [2] [3] [4] [5] [6]

🥜 GIF

lack-of-hustle

Copy link
Copy Markdown
Contributor

@taterhead247 taterhead247 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks straight forward. In line with what was done with Auth and Codex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Draft

Development

Successfully merging this pull request may close these issues.

2 participants