config

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: MIT Imports: 5 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 {
	Timezone     string             `toml:"timezone"`
	Admins       []int64            `toml:"admins"`
	Debug        bool               `toml:"debug"`
	TimeLocation *time.Location     `toml:"-"`
	AdminIDs     map[int64]struct{} `toml:"-"`
}

type Config

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

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"`
	QueryTimeout int           `toml:"query_timeout"`
	Timeout      time.Duration `toml:"-"`
}

type Fetcher

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

Fetcher contains fetcher configuration.

func (*Fetcher) AuthToken

func (f *Fetcher) AuthToken() string

AuthToken returns the authorization token with the required prefix.

type Holidayer added in v0.0.12

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

Holidayer contains holidayer configuration.

type Predictor added in v0.0.13

type Predictor struct {
	Active bool  `toml:"active"`
	Hours  uint8 `toml:"hours"`
}

Predictor contains predictor configuration.

type Telegram

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

Telegram contains Telegram bot configuration.

Jump to

Keyboard shortcuts

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