config

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Type         string   `koanf:"type" validate:"oneof=noop user-agent header"`
	UserAgents   []string `koanf:"user_agents" validate:"required_if=Type user-agent"`
	HeaderValues []string `koanf:"header_values" validate:"required_if=Type header"`
	HeaderName   string   `koanf:"header_name" validate:"required_if=Type header"`
}

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(k *koanf.Koanf, path string, config map[string]interface{}) *Builder

type Config

type Config struct {
	Server Server  `koanf:"server" validate:"required"`
	Stores []Store `koanf:"stores" validate:"required,gt=0,dive,required"`
}

func NewConfig

func NewConfig(path string) (config *Config, err error)

type Credentials

type Credentials struct {
	Id     string   `koanf:"id" validate:"required"`
	Scopes []string `koanf:"scopes"`
	Secret string   `koanf:"secret" validate:"required"`
	Url    string   `koanf:"url" validate:"required,url"`
}

type Server

type Server struct {
	Addr string `koanf:"addr" validate:"required"`
	Cert string `koanf:"cert" validate:"required_if=Tls true"`
	Key  string `koanf:"key" validate:"required_if=Tls true"`
	Tls  bool   `koanf:"tls"`
}

type Store

type Store struct {
	Target      string      `koanf:"target" validate:"omitempty,url"`
	Path        string      `koanf:"path" validate:"required"`
	Interval    int         `koanf:"interval" validate:"required"`
	Auth        Auth        `koanf:"auth" validate:"required"`
	Credentials Credentials `koanf:"credentials" validate:"required"`
}

Jump to

Keyboard shortcuts

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