GCP API
Google Cloud Platform utilities for project discovery, Cloud Run URLs, and App Engine metadata.
What It Does
The GCP API provides essential utilities for building applications on Google Cloud Platform. It handles intelligent project ID discovery, Cloud Run service URL generation, App Engine metadata extraction, and Identity-Aware Proxy integration—eliminating boilerplate for common GCP operations.
Key Capabilities
| Capability | Description |
|---|---|
| Project ID Discovery | Multi-source project ID resolution with caching |
| Cloud Run URL Building | Generate service URLs with project number and region support |
| App Engine Metadata | Extract deployment, instance, and runtime information |
| IAP Integration | OAuth audience discovery for Identity-Aware Proxy |
| Default Location | Regional configuration utilities |
| Project Number Resolution | Get numeric project identifier from Resource Manager |
| Environment Detection | Identify runtime environment (Flex, Standard, Cloud Run, Functions) |
Configuration
Environment Variables
- GCP_PROJECT / GOOGLE_CLOUD_PROJECT / GCLOUD_PROJECT / PROJECT_ID: Project ID
- FIREBASE_CONFIG: Firebase configuration with project ID
- PROJECT_HASH: Legacy project identifier
- PROJECT_NUMBER: Modern project identifier
- E11_QUEUE_LOCATION: Default region override
Default Values
- Default Region: us-central1
- Redis Host: localhost
- Redis Port: 6379
Exports
Classes
Project- Project discovery utilitiesCloudRun- Cloud Run URL buildingAppEngine- App Engine metadata (constants and types)
Functions
Project.findProjectId()- Async project discoveryProject.findProjectIdSync()- Sync project discoveryProject.findProjectNumber()- Get project numberProject.findProjectFlyweight()- Get complete metadataProject.defaultLocation()- Get default regionCloudRun.buildUrl()- Generate Cloud Run URLsfindAppEngineAudience()- IAP audience discovery
Types and Constants
EnvironmentType- Flex or StandardGAE_DEFAULT_LOCATION- us-central1- Error types
Common Use Cases
- Service discovery: Generate Cloud Run service URLs
- Multi-environment apps: Discover project context across GCP services
- Regional routing: Build region-specific endpoints
- IAP security: Find OAuth audiences for secured services
- Metadata collection: Extract App Engine deployment information
- Configuration: Resolve project-specific settings
What Customers Don’t Have to Build
- Project ID discovery from multiple sources
- Environment variable fallback logic
- Resource Manager API integration
- Cloud Run URL formatting
- Region code transformation
- App Engine metadata extraction
- IAP OAuth audience discovery
- Caching for project lookups
- Default location management
- Project number resolution
- Flyweight metadata aggregation
Last updated on