configuration

package
v0.0.0-...-0bd8f4c Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API_URL                        string = "snyk_api"                      // AKA "endpoint" in the config file
	AUTHENTICATION_SUBDOMAINS      string = "internal_auth_subdomain"       // array of additional subdomains to add authentication for
	AUTHENTICATION_ADDITIONAL_URLS string = "internal_additional_auth_urls" // array of additional urls to add authentication for
	AUTHENTICATION_TOKEN           string = "snyk_token"
	//nolint:gosec // not a token value, a configuration key
	AUTHENTICATION_BEARER_TOKEN     string = "snyk_oauth_token"
	INTEGRATION_NAME                string = "snyk_integration_name"
	INTEGRATION_VERSION             string = "snyk_integration_version"
	INTEGRATION_ENVIRONMENT         string = "snyk_integration_environment"
	INTEGRATION_ENVIRONMENT_VERSION string = "snyk_integration_environment_version"
	ANALYTICS_DISABLED              string = "snyk_disable_analytics"
	ORGANIZATION                    string = "org"
	DEBUG                           string = "debug"
	DEBUG_FORMAT                    string = "debug_format"
	INSECURE_HTTPS                  string = "insecure"
	PROXY_AUTHENTICATION_MECHANISM  string = "proxy_auth"
	CACHE_PATH                      string = "snyk_cache_path"
	WORKFLOW_USE_STDIO              string = "internal_wflstdio"
	RAW_CMD_ARGS                    string = "internal_raw_cmd_args"
	WEB_APP_URL                     string = "internal_snyk_app"
	INPUT_DIRECTORY                 string = "targetDirectory"
	ADD_TRUSTED_CA_FILE             string = "internal_additional_trusted_ca_file" // pem file location containing additional CAs to trust
	FIPS_ENABLED                    string = "gofips"
	WORKING_DIRECTORY               string = "internal_working_dir"
	IS_FEDRAMP                      string = "internal_is_fedramp"
	UNKNOWN_ARGS                    string = "internal_unknown_arguments" // arguments unknown to the current application but maybe relevant for delegated application calls
	TIMEOUT                         string = "snyk_timeout_secs"

	// feature flags
	FF_OAUTH_AUTH_FLOW_ENABLED string = "internal_snyk_oauth_enabled"
	FF_CODE_CONSISTENT_IGNORES string = "internal_snyk_code_ignores_enabled"

	// flags
	FLAG_EXPERIMENTAL       string = "experimental"
	FLAG_INCLUDE_IGNORES    string = "include-ignores"
	FLAG_SEVERITY_THRESHOLD string = "severity-threshold"
)

Variables

This section is empty.

Functions

func CreateConfigurationFile

func CreateConfigurationFile(filename string) (string, error)

CreateConfigurationFile creates a configuration file with the given name.

Types

type Configuration

type Configuration interface {
	Clone() Configuration

	Set(key string, value interface{})
	Get(key string) interface{}
	IsSet(key string) bool
	GetString(key string) string
	GetStringSlice(key string) []string
	GetBool(key string) bool
	GetInt(key string) int
	GetFloat64(key string) float64
	GetUrl(key string) *url.URL

	AddFlagSet(flagset *pflag.FlagSet) error
	AllKeys() []string
	AddDefaultValue(key string, defaultValue DefaultValueFunction)
	AddAlternativeKeys(key string, altKeys []string)
	GetAlternativeKeys(key string) []string

	// PersistInStorage ensures that when Set is called with the given key, it will be persisted in the config file.
	PersistInStorage(key string)
	SetStorage(storage Storage)
	GetStorage() Storage
}

Configuration is an interface for managing configuration values.

func New

func New() Configuration

New creates a new snyk configuration file.

func NewFromFiles

func NewFromFiles(files ...string) Configuration

NewFromFiles creates a new Configuration instance from the given files.

func NewInMemory

func NewInMemory() Configuration

NewInMemory creates a new Configuration instance that is not persisted to disk.

type DefaultValueFunction

type DefaultValueFunction func(existingValue interface{}) interface{}

func StandardDefaultValueFunction

func StandardDefaultValueFunction(defaultValue interface{}) DefaultValueFunction

StandardDefaultValueFunction is a default value function that returns the default value if the existing value is nil.

type EmptyStorage

type EmptyStorage struct{}

func (*EmptyStorage) Set

func (e *EmptyStorage) Set(_ string, _ any) error

type JsonStorage

type JsonStorage struct {
	// contains filtered or unexported fields
}

func NewJsonStorage

func NewJsonStorage(path string) *JsonStorage

func (*JsonStorage) Set

func (s *JsonStorage) Set(key string, value any) error

type Storage

type Storage interface {
	Set(key string, value any) error
}

Jump to

Keyboard shortcuts

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