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.
Click to show internal directories.
Click to hide internal directories.