config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config provides configuration loading and validation for the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	TimeLocation *time.Location     `toml:"-"`
	AdminIDs     map[int64]struct{} `toml:"-"`
	Timezone     string             `toml:"timezone"`
	Admins       []int64            `toml:"admins"`
	Debug        bool               `toml:"debug"`
}

Base contains base application settings.

type Config

type Config struct {
	Telegram  Telegram  `toml:"telegram"`
	Base      Base      `toml:"base"`
	Database  Database  `toml:"database"`
	Fetcher   Fetcher   `toml:"fetcher"`
	Holidayer Holidayer `toml:"holidayer"`
	Predictor Predictor `toml:"predictor"`
}

Config represents the application configuration.

func Load

func Load(path string) (*Config, error)

Load reads and parses a TOML configuration file.

type Database

type Database struct {
	Path         string        `toml:"path"`
	Timeout      time.Duration `toml:"-"`
	QueryTimeout int           `toml:"query_timeout"`
	Threads      uint8         `toml:"threads"`
}

Database contains database connection settings.

type Fetcher

type Fetcher struct {
	Token   string        `toml:"token"`
	URL     string        `toml:"url"`
	Timeout time.Duration `toml:"-"`
	Period  int           `toml:"period"`
	Active  bool          `toml:"active"`
}

Fetcher contains fetcher configuration.

func (*Fetcher) AuthToken

func (f *Fetcher) AuthToken() string

AuthToken returns the authorization token with Bearer prefix.

type Holidayer added in v0.0.12

type Holidayer struct {
	URL     string        `toml:"url"`
	Timeout time.Duration `toml:"-"`
	Period  int           `toml:"period"`
	Active  bool          `toml:"active"`
}

Holidayer contains holidayer configuration.

type Predictor added in v0.0.13

type Predictor struct {
	Hours        uint8         `toml:"hours"`
	Active       bool          `toml:"active"`
	LoadSize     int           `toml:"load_size"`
	Timeout      time.Duration `toml:"-"`
	QueryTimeout int           `toml:"query_timeout"`
}

Predictor contains predictor configuration.

type Telegram

type Telegram struct {
	Token  string `toml:"token"`
	Active bool   `toml:"active"`
}

Telegram contains Telegram bot configuration.

Jump to

Keyboard shortcuts

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