configuration

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDiscordName  = errors.New("invalid json value: discord.name is empty")
	ErrDiscordToken = errors.New("invalid json value: discord.token is empty")
	ErrLogFilename  = errors.New("invalid json value: log.filename is empty")
	ErrLogLevel     = errors.New("invalid json value: log.level is invalid")
)

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Discord `json:"discord"`
	Log     `json:"log"`
	Modules `json:"modules"`
}

Configuration contains Discord, Log and Modules parameters.

func ReadConfiguration

func ReadConfiguration(fsys fs.FS, filename string) (*Configuration, error)

ReadConfiguration read `config.json` file and update values with env if found.

type Discord added in v1.0.0

type Discord struct {
	Name  string `env:"DBOT_DISCORD_NAME"  json:"name"`
	Token string `env:"DBOT_DISCORD_TOKEN" json:"token"`
}

type Log added in v1.0.0

type Log struct {
	Filename            string `env:"DBOT_LOG_FILENAME"              json:"filename"`
	Level               string `env:"DBOT_LOG_LEVEL"                 json:"level"`
	NumberFilesRotation int    `env:"DBOT_LOG_NUMBER_FILES_ROTATION" json:"number_files_rotation"`
}

type Modules added in v1.0.0

type Modules struct {
	WelcomeConfiguration     welcome.Configuration      `json:"welcome"`
	HealthcheckConfiguration healthchecks.Configuration `json:"healthchecks"`
}

Jump to

Keyboard shortcuts

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