config

package
v0.0.0-...-efa4d4d Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(config *Config)

InitLogger initializes the logger

func ParseConfFile

func ParseConfFile(filename string, c *Config) error

ParseConfFile parses configuration in `filename`, saves it in `c` and returns an error

func SaveToFile

func SaveToFile(filename string, c Config) error

Types

type Config

type Config struct {
	Main     Main                  `yaml:"main"`
	Identity Identity              `yaml:"identity"`
	Servers  map[string]ServerOpts `yaml:"servers"`
	Plugins  map[string]string     `yaml:"plugins"`
}

func FromContext

func FromContext(ctx context.Context) Config

FromContext extracts configuration from a config if present

func (Config) Context

func (c Config) Context(ctx context.Context) context.Context

Context returns a new context from ctx with c attached

func (Config) ServerPort

func (c Config) ServerPort(s string) string

ServerPort returns a string of servername:port

type Identity

type Identity struct {
	Nick       string `yaml:"nick"`
	Name       string `yaml:"name"`
	Modestring string `yaml:"modestring"`
}

type Main

type Main struct {
	Logfile     string    `yaml:"logfile"`
	LogLevel    string    `yaml:"loglevel"`
	LogWriter   io.Writer `yaml:"-"`
	CommandChar string    `yaml:"commandchar"`
}

type ServerOpts

type ServerOpts struct {
	Port               int      `yaml:"port"`
	SSL                bool     `yaml:"ssl"`
	SkipInsecureVerify bool     `yaml:"sslskipverify"`
	Password           string   `yaml:"password"`
	Channels           []string `yaml:"channels"`
	Ignore             []string `yaml:"ignore"`
	Identity           Identity `yaml:"identity"`
}

Jump to

Keyboard shortcuts

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