gcp

package
v0.76.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigEnvPrefix is the prefix applied to environment variables for configuring Auth0.
	ConfigEnvPrefix = "GOOGLE_CLOUD_"
)

Variables

View Source
var LoadConfig = sync.OnceValues(func() (*Config, error) {
	if err := config.Load(ConfigEnvPrefix, &cfg); err != nil {
		return nil, fmt.Errorf("google: unable to load config: %w", err)
	}
	if cfg.ProjectID == "" {

		cfg.ProjectID, _ = queryMetadataServer("/computeMetadata/v1/project/project-id")
	}

	cfg.InstanceID, _ = queryMetadataServer("/computeMetadata/v1/instance/id")

	if err := validation.Validate.Struct(cfg); err != nil {
		return nil, fmt.Errorf("google: unable to validate config: %w", err)
	}

	slog.Info("GCP config loaded.")
	return &cfg, nil
})

LoadConfig loads the auth0 configuration and ensures this is only done one time, no matter how many times it is called.

Functions

func ReportError added in v0.75.0

func ReportError(ctx context.Context, err error)

ReportError reports an error to the Cloud Console. The error client autopopulates the error context of the error. For more details about the context see: https://cloud.google.com/error-reporting/reference/rest/v1beta1/ErrorContext.

Types

type Config

type Config struct {
	ProjectID  string `koanf:"project" validate:"required"`
	InstanceID string
	Service    string
	Revision   string
}

Config contains the pubsub configuration options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL