secrets

package
v1.56.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package secrets provides utilities for loading webhook secrets from the environment.

Use LoadFromEnv to collect all environment variables whose names begin with "WEBHOOK_SECRET" as webhook signing secrets. A secret named WEBHOOK_SECRET_<NAME> is bound to the hook IDs in BOUND_WEBHOOK_IDS_<NAME> when that variable is set.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFromEnv

func LoadFromEnv(ctx context.Context) (unbound [][]byte, bound []trampoline.BoundSecret)

LoadFromEnv loads every environment variable whose name starts with WEBHOOK_SECRET as a webhook secret. WEBHOOK_SECRET_<NAME> is bound to the comma-separated hook IDs in BOUND_WEBHOOK_IDS_<NAME> when that variable is set; every other secret is unbound.

Example
package main

import (
	"context"
	"fmt"

	"github.com/chainguard-dev/terraform-infra-common/modules/github-events/internal/secrets"
)

func main() {
	ctx := context.Background()
	// LoadFromEnv reads all WEBHOOK_SECRET* environment variables and binds
	// WEBHOOK_SECRET_<NAME> to the hook IDs in BOUND_WEBHOOK_IDS_<NAME>.
	// With no such variables set, it returns nil for both.
	unbound, bound := secrets.LoadFromEnv(ctx)
	fmt.Println(len(unbound), len(bound))
}
Output:
0 0

Types

This section is empty.

Jump to

Keyboard shortcuts

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