config

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Users        []AuthUser
	Pigeons      []AuthPigeon
	ServiceToken string `yaml:"service_token"`
}

AuthConfig contains all settings related to authentication and authorization.

type AuthPigeon

type AuthPigeon struct {
	Name  string
	Token string
}

AuthPigeon contains credentials used to authenticate a single pigeon.

type AuthUser

type AuthUser struct {
	Username     string
	PasswordHash string `yaml:"password_hash"`
}

AuthUser contains credentials used to authenticate a single user.

type GRPCConfig

type GRPCConfig struct {
	Addr string
}

GRPCConfig contains configuration for the gRPC server.

type Immutable

type Immutable struct {
	Storage StorageConfig
	GRPC    GRPCConfig
	Web     WebConfig
}

Immutable contains immutable settings which are set only once at launch time.

func ReadImmutable

func ReadImmutable(pflags *pflag.FlagSet) Immutable

ReadImmutable reads the immutable config from the specified flags and environment variables.

type Mutable

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

Mutable wraps MutableConfig with support for hot-reloading and modifications.

func ReadMutable

func ReadMutable(path string) (*Mutable, error)

ReadMutable reads the mutable configuration file, creating one if it isn't present.

func (*Mutable) AuthPigeons

func (m *Mutable) AuthPigeons() map[string]string

AuthPigeons returns the auth.pigeons setting represented as a map from token to pigeon name.

func (*Mutable) AuthServiceToken

func (m *Mutable) AuthServiceToken() string

AuthServiceToken returns the auth.service_token setting.

func (*Mutable) AuthUsers

func (m *Mutable) AuthUsers() map[string]string

AuthUsers returns the auth.users setting represented as a map from username to password hash.

func (*Mutable) Reload

func (m *Mutable) Reload() error

Reload reloads the whole config from the file from which it was originally loaded.

func (*Mutable) SetMutableConfig

func (m *Mutable) SetMutableConfig(c MutableConfig) error

SetMutableConfig changes the used mutable config, if the one passed is valid.

type MutableConfig

type MutableConfig struct {
	Auth AuthConfig
}

MutableConfig contains all settings which can be changed during execution.

type StorageConfig

type StorageConfig struct {
	Path string
}

StorageConfig contains the storage configuration.

type ValidationError

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

A validation error is returned during a reload of the config if the new configuration is invalid.

func (*ValidationError) Error

func (e *ValidationError) Error() string

type WebConfig

type WebConfig struct {
	Addr string
}

WebConfig contains configuration for the web (HTTP) server.

Jump to

Keyboard shortcuts

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