config

package
v0.0.0-...-3c02646 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyLogLevelFromString

func ApplyLogLevelFromString(cfg *Config, level string)

ApplyLogLevelFromString applies the appropriate log level from the string-variant of the level.

func GenerateEncryptionKey

func GenerateEncryptionKey() (string, error)

Types

type AutoTLSConfig

type AutoTLSConfig struct {
	Production bool              `hcl:"production,optional"`
	Email      string            `hcl:"email,attr"`
	Domains    []string          `hcl:"domains,attr"`
	DNS        *AutoTLSDNSConfig `hcl:"dns,block"`
}

type AutoTLSDNSConfig

type AutoTLSDNSConfig struct {
	Provider string `hcl:"solver,label"`
	APIToken string `hcl:"token,attr"`
}

type ClusterAutoJoinConfig

type ClusterAutoJoinConfig struct {
	Type     string `hcl:"type,label"`
	URL      string `hcl:"url,optional"`
	Subject  string `hcl:"subject,optional"`
	Provider string `hcl:"provider,optional"`
	// contains filtered or unexported fields
}

type ClusterConfig

type ClusterConfig struct {
	Join              *ClusterAutoJoinConfig `hcl:"autojoin,block"`
	Environment       string                 `hcl:"environment,attr"`
	BindAddress       string                 `hcl:"bind_address,optional"`
	BindPort          int                    `hcl:"bind_port,optional"`
	BindMemberAddress string                 `hcl:"memberlist_bind_address,optional"`
	BindMemberPort    int                    `hcl:"memberlist_bind_port,optional"`
}

type Config

type Config struct {
	EncryptionKey string `hcl:"encryption_key,optional"`
	LogLevel      log.Level
	Database      *DatabaseConfig  `hcl:"database,block"`
	HTTP          *HTTPConfig      `hcl:"http,block"`
	Events        *EventsConfig    `hcl:"events,block"`
	Cluster       *ClusterConfig   `hcl:"cluster,block"`
	Developer     *DeveloperConfig `hcl:"developer,block"`
	Remaining     hcl.Body         `hcl:",remain"`
}

func NewDevelopment

func NewDevelopment() (*Config, error)

NewDevelopment creates a Config instance for development purposes where persistence, pubsub, and other service requirements are minimal and can rely on the default in-memory implementations.

This function returns a working Response Server Config instance but persistence is not enabled by default. If persistence is required Response will need to be started with a config file instead of with development defaults.

func NewFromFile

func NewFromFile(path string) (*Config, *spec.Diagnostics)

func (*Config) SetLogLevelFromStr

func (c *Config) SetLogLevelFromStr(level string)

SetLogLevelFromStr sets the log level from the string-variant of the level's name. Supported strings include trace, debug, info, warn, error, and off. If an unsupported string is provided the `info` level will be set.

type DatabaseConfig

type DatabaseConfig struct {
	Type     string            `hcl:"type,optional"`
	Path     string            `hcl:"path,optional"`
	URL      string            `hcl:"url,optional"`
	Name     string            `hcl:"name,optional"`
	Host     string            `hcl:"host,optional"`
	Port     int               `hcl:"port,optional"`
	Username string            `hcl:"username,optional"`
	Password string            `hcl:"password,optional"`
	Options  map[string]string `hcl:"options,optional"`
}

type DeveloperConfig

type DeveloperConfig struct {
	Profiling bool `hcl:"profiling,optional"`
}

type EventsConfig

type EventsConfig struct {
	Type    string `hcl:"type,optional"`
	URL     string `hcl:"url,optional"`
	Subject string `hcl:"subject,optional"`
}

type HTTPConfig

type HTTPConfig struct {
	BindAddress   string     `hcl:"bind_address,optional"`
	Port          int        `hcl:"port,optional"`
	MaxUploadSize int        `hcl:"max_upload_size,optional"`
	TLS           *TLSConfig `hcl:"tls,block"`
}

type TLSConfig

type TLSConfig struct {
	Port     int            `hcl:"port,optional"`
	CertPath string         `hcl:"cert_path,optional"`
	KeyPath  string         `hcl:"key_path,optional"`
	Auto     *AutoTLSConfig `hcl:"auto,block"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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