config

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config handles configuration of the bot and is also a store for global variables such as version, etc which are set on building via the Makefile.

Index

Constants

This section is empty.

Variables

View Source
var BuildHash = unset

BuildHash is set by the Makefile and is the current git hash when the binary was built. Note if there are uncommitted changes in repository then the hash may not be accurate.

View Source
var BuildTimestamp = unset

BuildTimestamp is set by the Makefile and is the time the binary was built.

View Source
var BuildVersion = unset

BuildVersion is set by the Makefile and is taken from the git branch, or git tag.

Functions

func Report

func Report(settings Settings)

Report the settings to the logfile.

func Usage

func Usage()

Usage prints the usage string.

Types

type AWS added in v0.1.13

type AWS struct {
	Region    string
	Bucket    string
	AccessKey string
	SecretKey string
}

AWS options.

func (*AWS) Configure added in v0.1.13

func (a *AWS) Configure(opts *goconfigure.Options)

Configure the AWS options.

func (*AWS) Report added in v0.1.13

func (a *AWS) Report()

Report the configuration for AWS.

type Discord added in v0.1.13

type Discord struct {
	Name  string
	Token string

	Bearer string
	Avatar string
	Prefix string
}

Discord options.

func (*Discord) Configure added in v0.1.13

func (d *Discord) Configure(opts *goconfigure.Options)

Configure the Discord options.

func (*Discord) Report added in v0.1.13

func (d *Discord) Report()

Report the configuration for Discord.

type Limiter added in v0.1.5

type Limiter struct {
	// Depth of the limiter (i.e. number of distinct items to hold)
	Depth int

	// Limit at which the limiter will trip (i.e. the number of time something
	// needs to be seen before the limiter trips)
	Limit int

	// TTL for the items in the limiter
	TTL time.Duration
}

Limiter configuration.

func (*Limiter) Configure added in v0.1.5

func (l *Limiter) Configure(opts *goconfigure.Options, name string, limit int)

Configure the limiter.

func (*Limiter) Report added in v0.1.5

func (l *Limiter) Report(name string)

Report the configuration for the Limiter.

type Limiters added in v0.1.5

type Limiters struct {
	// Source limiter rate limits connections from the same source.
	Source Limiter

	// User limiter rate limits connections from the same user.
	User Limiter
}

Limiters in use by the system.

func (*Limiters) Configure added in v0.1.5

func (l *Limiters) Configure(opts *goconfigure.Options)

Configure the limiter.

func (*Limiters) Report added in v0.1.5

func (l *Limiters) Report()

Report the configuration for the Limiter.

type Security added in v0.1.5

type Security struct {
	// Secret used to encode the JWT tokens
	Secret string

	// SessionTTL is the length of time a session will be valid for before
	// it requires re-authentication.
	SessionTTL time.Duration

	// Timebox is the minimum time it will take for a login attempt to
	// return.
	Timebox time.Duration

	Limiters
}

Security options.

func (*Security) Configure added in v0.1.5

func (s *Security) Configure(opts *goconfigure.Options)

Configure the security options.

func (*Security) Report added in v0.1.5

func (s *Security) Report()

Report the configuration for the security settings.

type Server added in v0.1.13

type Server struct {
	Port             int
	StoreConfig      string
	ChatClientConfig string
}

Server options.

func (*Server) Configure added in v0.1.13

func (s *Server) Configure(opts *goconfigure.Options)

Configure the Server options.

func (*Server) Report added in v0.1.13

func (s *Server) Report()

Report the configuration for Server.

type Settings

type Settings struct {
	Bearer string

	Server   Server
	Discord  Discord
	Security Security
	AWS      AWS

	message.Sender
	// contains filtered or unexported fields
}

Settings available to the bot.

func Configure

func Configure() (Settings, error)

Configure the bot from the defined configuration settings.

Jump to

Keyboard shortcuts

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