apikey

package
v1.106.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchPattern

func MatchPattern(ctx context.Context, fp string, patterns []MapPattern) (string, bool)

MatchPattern matches regex against entity's path to find alternate api key.

func WithReplacing

func WithReplacing(config Config) heartbeat.HandleOption

WithReplacing initializes and returns a heartbeat handle option, which can be used in a heartbeat processing pipeline to replace default api key for a heartbeat following the provided configurations.

Types

type Config

type Config struct {
	// DefaultAPIKey contains the default api key.
	DefaultAPIKey string
	// Patterns contains the overridden api key per path.
	MapPatterns []MapPattern
}

Config contains apikey project detection configurations.

type MapPattern

type MapPattern struct {
	// APIKey is the project related api key.
	APIKey string
	// Regex is the regular expression for a specific path.
	Regex regex.Regex
}

MapPattern contains [project_api_key] data.

Jump to

Keyboard shortcuts

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