config

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	ID    string `toml:"id"`
	Nick  string `toml:"nick"`
	Token string `toml:"token"`
	ULR   string `toml:"url"`
	Src   string `toml:"src"`
}

Bot contains base API configuration parameters.

type BuildInfo added in v0.2.0

type BuildInfo struct {
	Name      string
	Hash      string
	Revision  string
	GoVersion string
	Date      string
	URL       string
}

BuildInfo is a build information.

type Config

type Config struct {
	sync.Mutex
	BotSettings Bot  `toml:"bot"`
	M           Main `toml:"main"`
	L           Log  `toml:"log"`
	Bot         *botgolang.Bot
	DB          *sql.DB
	BuildInfo   *BuildInfo
	// contains filtered or unexported fields
}

Config is common configuration struct.

func New

func New(fileName string, b *BuildInfo, server *httptest.Server) (*Config, error)

New returns new configuration.

func (*Config) Close added in v0.2.0

func (c *Config) Close() error

Close free resources.

func (*Config) Context added in v0.2.0

func (c *Config) Context() (context.Context, context.CancelFunc)

Context returns context with timeout.

type Log added in v0.3.0

type Log struct {
	PidFile string `toml:"pidfile"`
	LogFile string `toml:"logfile"`
	Output  io.WriteCloser
}

Log is a logging configuration settings.

type Main added in v0.2.0

type Main struct {
	Debug   bool   `toml:"debug"`
	Storage string `toml:"storage"`
	Timeout uint64 `toml:"timeout"`
	Workers int    `toml:"workers"`
}

Main is a basic configuration settings.

Jump to

Keyboard shortcuts

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