config

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commands

type Commands []string

func (Commands) At

func (c Commands) At(n int) string

type Config

type Config struct {
	// Root configurations
	IncludePaths []string `cli:"I,include_path" yaml:"include_paths"`
	Transforms   []string `cli:"t,transformer" yaml:"transformers"`
	Help         bool     `cli:"h,help"`
	Version      bool     `cli:"V"`
	Remote       bool     `cli:"r,remote" yaml:"remote"`
	Json         bool     `cli:"json"`
	Request      string   `cli:"request"`

	// Remote options, only provided via environment variable
	FastlyServiceID string `env:"FASTLY_SERVICE_ID"`
	FastlyApiKey    string `env:"FASTLY_API_KEY"`

	// CLI subcommands
	Commands Commands

	// Override Origin fetching URL
	OverrideBackends map[string]*OverrideBackend `yaml:"override_backends"`

	// Override resource limits
	OverrideMaxBackends int `cli:"max_backends" yaml:"max_backends"`
	OverrideMaxAcls     int `cli:"mac_acls" yaml:"max_acls"`

	// Linter configuration
	Linter *LinterConfig `yaml:"linter"`
	// Simulator configuration
	Simulator *SimulatorConfig `yaml:"simulator"`
	// Testing configuration
	Testing *TestConfig `yaml:"testing"`
}

func New

func New(args []string) (*Config, error)

type LinterConfig added in v1.0.0

type LinterConfig struct {
	VerboseLevel   string            `yaml:"verbose"`
	VerboseWarning bool              `cli:"v"`
	VerboseInfo    bool              `cli:"vv"`
	Rules          map[string]string `yaml:"rules"`
}

Linter configuration

type OverrideBackend added in v1.0.0

type OverrideBackend struct {
	Host      string `yaml:"host"`
	SSL       bool   `yaml:"ssl" default:"true"`
	Unhealthy bool   `yaml:"unhealthy" default:"false"`
}

type RequestConfig added in v1.0.0

type RequestConfig struct {
	RemoteIP       string            `yaml:"remote_ip" json:"remote_ip"`
	RequestHeaders map[string]string `yaml:"headers" json:"headers"`
	Path           string            `yaml:"path" json:"path"`
	UserAgent      string            `yaml:"user_agent" json:"user_agent"`
}

func LoadRequestConfig added in v1.0.0

func LoadRequestConfig(path string) (*RequestConfig, error)

func (*RequestConfig) SetRequest added in v1.0.0

func (r *RequestConfig) SetRequest(req *http.Request)

type SimulatorConfig added in v1.0.0

type SimulatorConfig struct {
	Port         int      `cli:"p,port" yaml:"port" default:"3124"`
	IsDebug      bool     `cli:"debug"` // Enable only in CLI option
	IncludePaths []string // Copy from root field

	// Override Request configuration
	OverrideRequest *RequestConfig
}

Simulator configuration

type TestConfig added in v1.0.0

type TestConfig struct {
	Timeout      int      `cli:"t,timeout" yaml:"timeout"`
	Filter       string   `cli:"f,filter" default:"*.test.vcl"`
	IncludePaths []string // Copy from root field
	OverrideHost string   `yaml:"host"`

	// Override Request configuration
	OverrideRequest *RequestConfig
}

Testing configuration

Jump to

Keyboard shortcuts

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