Documentation
¶
Overview ¶
Package config contains the schema and helper functions to work with the configuration file.
Index ¶
Constants ¶
View Source
const ( PolicyAllow = "allow" PolicyDeny = "deny" )
Accepted policy values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessControl ¶
type AccessControl struct { DefaultPolicy string `yaml:"default_policy" validate:"required,oneof=allow deny"` Rules []AccessControlRule `yaml:"rules" validate:"dive"` }
AccessControl represents the access control configuration.
type AccessControlRule ¶
type AccessControlRule struct { Policy string `yaml:"policy" validate:"required,oneof=allow deny"` Networks []CIDR `yaml:"networks,omitempty" validate:"dive,cidr"` Domains []string `yaml:"domains,omitempty" validate:"dive,domain"` Methods []string `yaml:"methods,omitempty" validate:"dive,oneof=GET HEAD POST PUT DELETE PATCH"` Countries []string `yaml:"countries,omitempty" validate:"dive,iso3166_1_alpha2"` AutonomousSystems []uint32 `yaml:"autonomous_systems,omitempty" validate:"dive,numeric"` }
AccessControlRule represents an access control rule.
type CIDR ¶
CIDR represents a CIDR network. It's used to support unmarshaling from YAML.
func (*CIDR) UnmarshalYAML ¶
UnmarshalYAML unmarshals a CIDR network from YAML.
type Configuration ¶
type Configuration struct {
AccessControl AccessControl `yaml:"access_control"`
}
Configuration represents the configuration of the application.
func ReadConfig ¶
func ReadConfig(reader io.Reader) (*Configuration, error)
ReadConfig reads the configuration from the given reader and returns it.
Click to show internal directories.
Click to hide internal directories.