package detect
import "cloud.google.com/go/internal/detect"
Package detect is used find information from the environment.
Index ¶
- Constants
- func ProjectID(ctx context.Context, projectID, emulatorEnvVar string, opts ...option.ClientOption) (string, error)
Constants ¶
const ( // ProjectIDSentinel is the value that users should pass for the project ID // to enable detection. ProjectIDSentinel = "*detect-project-id*" )
Functions ¶
func ProjectID ¶
func ProjectID(ctx context.Context, projectID, emulatorEnvVar string, opts ...option.ClientOption) (string, error)
ProjectID tries to detect the project ID from the environment if the sentinel value, "*detect-project-id*", is sent. It looks in the following order:
- GOOGLE_CLOUD_PROJECT envvar
- ADC creds.ProjectID
- A static value if the environment is emulated.
Source Files ¶
detect.go
- Version
- v0.118.3 (latest)
- Published
- Feb 20, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 5 hours ago –
Tools for package owners.