config

package
v0.1.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeepAliveInterval = 1 * time.Minute
)

Functions

func GetBool

func GetBool(key string, defaultValue bool) bool

func GetDuration

func GetDuration(key string, defaultValue time.Duration) (time.Duration, error)

func GetString

func GetString(key, defaultValue string) string

func GetStrings

func GetStrings(key string, defaultValue []string) []string

Types

type AuthProvider

type AuthProvider struct {
	Issuer            string            `yaml:"issuer"`
	ClientID          string            `yaml:"client_id"`
	ClientSecret      string            `yaml:"client_secret"`
	Scopes            []string          `yaml:"additional_scopes"`
	SystemAdminPolicy SystemAdminPolicy `yaml:"system_admins"`
}

type Config

type Config struct {
	HttpListenAddr    string       `yaml:"http_listen_addr,omitempty"`
	HttpsListenAddr   string       `yaml:"https_listen_addr,omitempty"`
	MetricsListenAddr string       `yaml:"metrics_listen_addr,omitempty"`
	ServerUrl         string       `yaml:"server_url,omitempty"`
	Tls               Tls          `yaml:"tls,omitempty"`
	PollNet           PollNet      `yaml:"poll_net,omitempty"`
	Keys              Keys         `yaml:"keys,omitempty"`
	Database          Database     `yaml:"database,omitempty"`
	AuthProvider      AuthProvider `yaml:"auth_provider,omitempty"`
	Logging           Logging      `yaml:"logging,omitempty"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) CreateUrl

func (c *Config) CreateUrl(format string, a ...interface{}) string

func (*Config) ReadServerKeys

func (c *Config) ReadServerKeys() (*ServerKeys, error)

type Database

type Database struct {
	Type string `yaml:"type,omitempty"`
	Url  string `yaml:"url,omitempty"`
}

type Keys

type Keys struct {
	ControlKey       string `yaml:"control_key,omitempty"`
	LegacyControlKey string `yaml:"legacy_control_key,omitempty"`
	SystemAdminKey   string `yaml:"system_admin_key,omitempty"`
}

type Logging

type Logging struct {
	Level  string `yaml:"level,omitempty"`
	Format string `yaml:"format,omitempty"`
	File   string `yaml:"file,omitempty"`
}

type PollNet

type PollNet struct {
	KeepAliveInterval time.Duration `yaml:"keep_alive_interval"`
}

type ServerKeys

type ServerKeys struct {
	SystemAdminKey   *key.ServerPrivate
	ControlKey       tkey.MachinePrivate
	LegacyControlKey tkey.MachinePrivate
}

type SystemAdminPolicy

type SystemAdminPolicy struct {
	Subs    []string `json:"subs,omitempty"`
	Emails  []string `json:"emails,omitempty"`
	Filters []string `json:"filters,omitempty"`
}

type Tls

type Tls struct {
	Disable     bool   `yaml:"disable"`
	ForceHttps  bool   `yaml:"force_https"`
	CertFile    string `yaml:"cert_file,omitempty"`
	KeyFile     string `yaml:"key_file,omitempty"`
	AcmeEnabled bool   `yaml:"acme,omitempty"`
	AcmeEmail   string `yaml:"acme_email,omitempty"`
	AcmeCA      string `yaml:"acme_ca,omitempty"`
	AcmePath    string `yaml:"acme_path,omitempty"`
}

Jump to

Keyboard shortcuts

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