configuration

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	API_URL                        string = "w3security_api"          // AKA "endpoint" in the config file
	AUTHENTICATION_SUBDOMAINS      string = "internal_auth_subdomain" // array of additional subdomains to add authentication for
	AUTHENTICATION_TOKEN           string = "token"
	AUTHENTICATION_BEARER_TOKEN    string = "bearer_token"
	INTEGRATION_NAME               string = "w3security_integration_name"
	INTEGRATION_VERSION            string = "w3security_integration_version"
	ANALYTICS_DISABLED             string = "w3security_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 = "w3security_cache_path"
	WORKFLOW_USE_STDIO             string = "wflstdio"
	RAW_CMD_ARGS                   string = "raw_cmd_args"
	WEB_APP_URL                    string = "internal_w3security_app"
	INPUT_DIRECTORY                string = "targetDirectory"
	ADD_TRUSTED_CA_FILE            string = "internal_additional_trusted_ca_file" // pem file location containing additional CAs to trust

	// feature flags
	FF_OAUTH_AUTH_FLOW_ENABLED string = "internal_w3security_oauth_enabled"
)

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{}
	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 w3security 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