config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExpirationTime = 30 * time.Minute
	DefaultClearTime      = 30 * time.Minute
)

Variables

View Source
var (
	ErrNoToPair   = errors.New("`to` values are not set for every `from`")
	ErrNoFromPair = errors.New("`from` values are not set for every `to`")
)

Functions

func StaticDirMappingHookFunc added in v0.1.0

func StaticDirMappingHookFunc() mapstructure.DecodeHookFunc

func StringToTimeDurationHookFunc added in v0.2.0

func StringToTimeDurationHookFunc() mapstructure.DecodeHookFunc

func URLMappingHookFunc added in v0.1.0

func URLMappingHookFunc() mapstructure.DecodeHookFunc

Types

type CacheConfig added in v0.2.0

type CacheConfig struct {
	ExpirationTime time.Duration `mapstructure:"expiration-time"`
	ClearTime      time.Duration `mapstructure:"clear-time"`
	Methods        []string      `mapstructure:"methods"`
}

func (*CacheConfig) Clone added in v0.2.0

func (c *CacheConfig) Clone() *CacheConfig

type CacheGlobs added in v0.2.0

type CacheGlobs []string

func (CacheGlobs) Clone added in v0.2.0

func (g CacheGlobs) Clone() CacheGlobs

type Mapping added in v0.1.0

type Mapping struct {
	From    string            `mapstructure:"from"`
	To      string            `mapstructure:"to"`
	Statics StaticDirectories `mapstructure:"statics"`
	Mocks   Mocks             `mapstructure:"mocks"`
	Cache   CacheGlobs        `mapstructure:"cache"`
}

func (*Mapping) Clone added in v0.1.0

func (m *Mapping) Clone() Mapping

type Mappings added in v0.1.0

type Mappings []Mapping

func NormaliseMappings added in v0.1.0

func NormaliseMappings(mappings Mappings, httpPort int, httpsPort int, useHTTPS bool) Mappings

func (Mappings) String added in v0.1.0

func (m Mappings) String() string

type Mock added in v0.1.0

type Mock struct {
	Path     string            `mapstructure:"path"`
	Method   string            `mapstructure:"method"`
	Queries  map[string]string `mapstructure:"queries"`
	Headers  map[string]string `mapstructure:"headers"`
	Response Response          `mapstructure:"response"`
}

func (*Mock) Clone added in v0.1.0

func (m *Mock) Clone() Mock

func (*Mock) String added in v0.2.0

func (m *Mock) String() string

type Mocks added in v0.1.0

type Mocks []Mock

func (Mocks) Clone added in v0.1.0

func (m Mocks) Clone() Mocks

type Response added in v0.1.0

type Response struct {
	Code    int               `mapstructure:"code"`
	Headers map[string]string `mapstructure:"headers"`
	Raw     string            `mapstructure:"raw"`
	File    string            `mapstructure:"file"`
	Delay   time.Duration     `mapstructure:"delay"`
}

func (*Response) Clone added in v0.1.0

func (r *Response) Clone() Response

type StaticDirectories added in v0.1.0

type StaticDirectories []StaticDirectory

func (StaticDirectories) Clone added in v0.1.0

type StaticDirectory added in v0.1.0

type StaticDirectory struct {
	Path  string `mapstructure:"path"`
	Dir   string `mapstructure:"dir"`
	Index string `mapstructure:"index"`
}

func (*StaticDirectory) Clone added in v0.1.0

func (s *StaticDirectory) Clone() StaticDirectory

func (*StaticDirectory) String added in v0.2.0

func (s *StaticDirectory) String() string

type UncorsConfig added in v0.1.0

type UncorsConfig struct {
	HTTPPort    int         `mapstructure:"http-port"`
	Mappings    Mappings    `mapstructure:"mappings"`
	Proxy       string      `mapstructure:"proxy"`
	Debug       bool        `mapstructure:"debug"`
	HTTPSPort   int         `mapstructure:"https-port"`
	CertFile    string      `mapstructure:"cert-file"`
	KeyFile     string      `mapstructure:"key-file"`
	CacheConfig CacheConfig `mapstructure:"cache-config"`
}

func LoadConfiguration added in v0.1.0

func LoadConfiguration(viperInstance *viper.Viper, args []string) *UncorsConfig

func (*UncorsConfig) IsHTTPSEnabled added in v0.1.0

func (c *UncorsConfig) IsHTTPSEnabled() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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