config

package
v2.2.0-alpha26 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config provides configuration structures for the application.

Index

Constants

View Source
const InternalConfig = `
enableTesting: false
keployContainer: "keploy-v2"
keployNetwork: "keploy-network"
inDocker: false
cmdType: "native"
`

Variables

This section is empty.

Functions

func GetByPassPorts

func GetByPassPorts(conf *Config) []uint

func GetDefaultConfig

func GetDefaultConfig() string

func Merge

func Merge(srcStr, destStr string) (string, error)

func SetByPassPorts

func SetByPassPorts(conf *Config, ports []uint)

func SetDefaultConfig

func SetDefaultConfig(cfgStr string)

func SetSelectedTests

func SetSelectedTests(conf *Config, testSets []string)

func SetSelectedTestsNormalize

func SetSelectedTestsNormalize(conf *Config, value string) error

Types

type BypassRule

type BypassRule struct {
	Path string `json:"path" yaml:"path" mapstructure:"path"`
	Host string `json:"host" yaml:"host" mapstructure:"host"`
	Port uint   `json:"port" yaml:"port" mapstructure:"port"`
}

type Config

type Config struct {
	Path                  string       `json:"path" yaml:"path" mapstructure:"path"`
	AppID                 uint64       `json:"appId" yaml:"appId" mapstructure:"appId"`
	AppName               string       `json:"appName" yaml:"appName" mapstructure:"appName"`
	Command               string       `json:"command" yaml:"command" mapstructure:"command"`
	Port                  uint32       `json:"port" yaml:"port" mapstructure:"port"`
	DNSPort               uint32       `json:"dnsPort" yaml:"dnsPort" mapstructure:"dnsPort"`
	ProxyPort             uint32       `json:"proxyPort" yaml:"proxyPort" mapstructure:"proxyPort"`
	Debug                 bool         `json:"debug" yaml:"debug" mapstructure:"debug"`
	DisableTele           bool         `json:"disableTele" yaml:"disableTele" mapstructure:"disableTele"`
	DisableANSI           bool         `json:"disableANSI" yaml:"disableANSI" mapstructure:"disableANSI"`
	InDocker              bool         `json:"inDocker" yaml:"-" mapstructure:"inDocker"`
	ContainerName         string       `json:"containerName" yaml:"containerName" mapstructure:"containerName"`
	NetworkName           string       `json:"networkName" yaml:"networkName" mapstructure:"networkName"`
	BuildDelay            uint64       `json:"buildDelay" yaml:"buildDelay" mapstructure:"buildDelay"`
	Test                  Test         `json:"test" yaml:"test" mapstructure:"test"`
	Record                Record       `json:"record" yaml:"record" mapstructure:"record"`
	Gen                   UtGen        `json:"gen" yaml:"-" mapstructure:"gen"`
	Normalize             Normalize    `json:"normalize" yaml:"-" mapstructure:"normalize"`
	ReRecord              ReRecord     `json:"rerecord" yaml:"-" mapstructure:"rerecord"`
	ConfigPath            string       `json:"configPath" yaml:"configPath" mapstructure:"configPath"`
	BypassRules           []BypassRule `json:"bypassRules" yaml:"bypassRules" mapstructure:"bypassRules"`
	EnableTesting         bool         `json:"enableTesting" yaml:"-" mapstructure:"enableTesting"`
	GenerateGithubActions bool         `json:"generateGithubActions" yaml:"generateGithubActions" mapstructure:"generateGithubActions"`
	KeployContainer       string       `json:"keployContainer" yaml:"keployContainer" mapstructure:"keployContainer"`
	KeployNetwork         string       `json:"keployNetwork" yaml:"keployNetwork" mapstructure:"keployNetwork"`
	CommandType           string       `json:"cmdType" yaml:"cmdType" mapstructure:"cmdType"`
	InCi                  bool         `json:"inCi" yaml:"inCi" mapstructure:"inCi"`
}

func New

func New() *Config

type Filter

type Filter struct {
	BypassRule `mapstructure:",squash"`
	URLMethods []string          `json:"urlMethods" yaml:"urlMethods" mapstructure:"urlMethods"`
	Headers    map[string]string `json:"headers" yaml:"headers" mapstructure:"headers"`
}

type GlobalNoise

type GlobalNoise map[string]map[string][]string

type Globalnoise

type Globalnoise struct {
	Global   GlobalNoise  `json:"global" yaml:"global" mapstructure:"global"`
	Testsets TestsetNoise `json:"test-sets" yaml:"test-sets" mapstructure:"test-sets"`
}

type Language

type Language string

func (*Language) Set

func (e *Language) Set(v string) error

Set must have pointer receiver so it doesn't change the value of a copy

func (*Language) String

func (e *Language) String() string

String is used both by fmt.Print and by Cobra in help text

func (*Language) Type

func (e *Language) Type() string

Type is only used in help text

type Noise

type Noise map[string][]string

type Normalize

type Normalize struct {
	SelectedTests []SelectedTests `json:"selectedTests" yaml:"selectedTests" mapstructure:"selectedTests"`
	TestRun       string          `json:"testReport" yaml:"testReport" mapstructure:"testReport"`
}

type ReRecord

type ReRecord struct {
	SelectedTests []string `json:"selectedTests" yaml:"selectedTests" mapstructure:"selectedTests"`
	Filters       []Filter `json:"filters" yaml:"filters" mapstructure:"filters"`
}

type Record

type Record struct {
	Filters     []Filter      `json:"filters" yaml:"filters" mapstructure:"filters"`
	RecordTimer time.Duration `json:"recordTimer" yaml:"recordTimer" mapstructure:"recordTimer"`
}

type SelectedTests

type SelectedTests struct {
	TestSet string   `json:"testSet" yaml:"testSet" mapstructure:"testSet"`
	Tests   []string `json:"tests" yaml:"tests" mapstructure:"tests"`
}

type Test

type Test struct {
	SelectedTests      map[string][]string `json:"selectedTests" yaml:"selectedTests" mapstructure:"selectedTests"`
	GlobalNoise        Globalnoise         `json:"globalNoise" yaml:"globalNoise" mapstructure:"globalNoise"`
	Delay              uint64              `json:"delay" yaml:"delay" mapstructure:"delay"`
	APITimeout         uint64              `json:"apiTimeout" yaml:"apiTimeout" mapstructure:"apiTimeout"`
	SkipCoverage       bool                `json:"skipCoverage" yaml:"skipCoverage" mapstructure:"skipCoverage"`                   // boolean to capture the coverage in test
	CoverageReportPath string              `json:"coverageReportPath" yaml:"coverageReportPath" mapstructure:"coverageReportPath"` // directory path to store the coverage files
	IgnoreOrdering     bool                `json:"ignoreOrdering" yaml:"ignoreOrdering" mapstructure:"ignoreOrdering"`
	MongoPassword      string              `json:"mongoPassword" yaml:"mongoPassword" mapstructure:"mongoPassword"`
	Language           Language            `json:"language" yaml:"language" mapstructure:"language"`
	RemoveUnusedMocks  bool                `json:"removeUnusedMocks" yaml:"removeUnusedMocks" mapstructure:"removeUnusedMocks"`
	FallBackOnMiss     bool                `json:"fallBackOnMiss" yaml:"fallBackOnMiss" mapstructure:"fallBackOnMiss"`
	JacocoAgentPath    string              `json:"jacocoAgentPath" yaml:"jacocoAgentPath" mapstructure:"jacocoAgentPath"`
	BasePath           string              `json:"basePath" yaml:"basePath" mapstructure:"basePath"`
	Mocking            bool                `json:"mocking" yaml:"mocking" mapstructure:"mocking"`
	IgnoredTests       map[string][]string `json:"ignoredTests" yaml:"ignoredTests" mapstructure:"ignoredTests"`
}

type TestsetNoise

type TestsetNoise map[string]map[string]map[string][]string

type UtGen

type UtGen struct {
	SourceFilePath     string  `json:"sourceFilePath" yaml:"sourceFilePath" mapstructure:"sourceFilePath"`
	TestFilePath       string  `json:"testFilePath" yaml:"testFilePath" mapstructure:"testFilePath"`
	CoverageReportPath string  `json:"coverageReportPath" yaml:"coverageReportPath" mapstructure:"coverageReportPath"`
	TestCommand        string  `json:"testCommand" yaml:"testCommand" mapstructure:"testCommand"`
	CoverageFormat     string  `json:"coverageFormat" yaml:"coverageFormat" mapstructure:"coverageFormat"`
	DesiredCoverage    float64 `json:"expectedCoverage" yaml:"expectedCoverage" mapstructure:"expectedCoverage"`
	MaxIterations      int     `json:"maxIterations" yaml:"maxIterations" mapstructure:"maxIterations"`
	TestDir            string  `json:"testDir" yaml:"testDir" mapstructure:"testDir"`
	APIBaseURL         string  `json:"llmBaseUrl" yaml:"llmBaseUrl" mapstructure:"llmBaseUrl"`
	Model              string  `json:"model" yaml:"model" mapstructure:"model"`
	APIVersion         string  `json:"llmApiVersion" yaml:"llmApiVersion" mapstructure:"llmApiVersion"`
}

Jump to

Keyboard shortcuts

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