config

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

config

-- import "github.com/Clever/sphinx/config"

Usage

func ValidateConfig
func ValidateConfig(config Config) error

ValidateConfig validates that a Config has all the required fields TODO (z): These should all be private, but right now tests depend on parsing bytes into yaml

type Config
type Config struct {
	Proxy       Proxy
	HealthCheck HealthCheck `yaml:"health-check"`
	Limits      map[string]Limit
	Storage     map[string]string
}

Config holds the yaml data for the config file

func LoadAndValidateYaml
func LoadAndValidateYaml(data []byte) (Config, error)

LoadAndValidateYaml turns a sequence of bytes into a Config and validates that all the necessary fields are set TODO (z): These should all be private, but right now tests depend on parsing bytes into yaml

func LoadYaml
func LoadYaml(data []byte) (Config, error)

LoadYaml loads byte data for a yaml file into a Config TODO (z): These should all be private, but right now tests depend on parsing bytes into yaml

func New
func New(path string) (Config, error)

New takes in a path to a configuration yaml and returns a Configuration.

type HealthCheck
type HealthCheck struct {
	Port     string
	Endpoint string
	Enabled  bool
}

HealthCheck holds the yaml data for how to run the health check service.

type Limit
type Limit struct {
	Interval uint
	Max      uint
	Keys     map[string]interface{}
	Matches  map[string]interface{}
	Excludes map[string]interface{}
}

Limit holds the yaml data for one of the limits in the config file

type Proxy
type Proxy struct {
	Handler      string
	Host         string
	Listen       string
	AllowOnError bool `yaml:"allow-on-error"`
}

Proxy holds the yaml data for the proxy option in the config file

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig

func ValidateConfig(config Config) error

ValidateConfig validates that a Config has all the required fields TODO (z): These should all be private, but right now tests depend on parsing bytes into yaml

Types

type Config

type Config struct {
	Proxy       Proxy
	HealthCheck HealthCheck `yaml:"health-check"`
	Limits      map[string]Limit
	Storage     map[string]string
}

Config holds the yaml data for the config file

func LoadAndValidateYaml

func LoadAndValidateYaml(data []byte) (Config, error)

LoadAndValidateYaml turns a sequence of bytes into a Config and validates that all the necessary fields are set TODO (z): These should all be private, but right now tests depend on parsing bytes into yaml

func LoadYaml

func LoadYaml(data []byte) (Config, error)

LoadYaml loads byte data for a yaml file into a Config TODO (z): These should all be private, but right now tests depend on parsing bytes into yaml

func New

func New(path string) (Config, error)

New takes in a path to a configuration yaml and returns a Configuration.

type HealthCheck added in v0.3.1

type HealthCheck struct {
	Port     string
	Endpoint string
	Enabled  bool
}

HealthCheck holds the yaml data for how to run the health check service.

type Limit

type Limit struct {
	Interval uint
	Max      uint
	Keys     map[string]interface{}
	Matches  map[string]interface{}
	Excludes map[string]interface{}
}

Limit holds the yaml data for one of the limits in the config file

type Proxy

type Proxy struct {
	Handler      string
	Host         string
	Listen       string
	AllowOnError bool `yaml:"allow-on-error"`
}

Proxy holds the yaml data for the proxy option in the config file

Jump to

Keyboard shortcuts

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