apikey

package
v1.52.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchPattern

func MatchPattern(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