config

package
v2.0.0-...-8533a87 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() string

Default path: home directory

Types

type Config

type Config struct {
	TelegramBot struct {
		Token    string `yaml:"token" envconfig:"BOT_TOKEN"`
		AdminIDs string `yaml:"admin_ids" envconfig:"BOT_ADMINIDS"`
	} `yaml:"telegram-bot"`
	TBCPusher struct {
		URL string `yaml:"url" envconfig:"TBCPUSHER_URL"`
	} `yaml:"tbcpusher"`
	Callback struct {
		Address string `yaml:"address" envconfig:"CALLBACK_ADDRESS"`
		Prefix  string `yaml:"prefix" envconfig:"CALLBACK_PREFIX"`
		URLBase string `yaml:"urlbase" envconfig:"CALLBACK_URLBASE"`
	} `yaml:"callback"`
}

Config is the configuration of the program.

func New

func New() Config

func (*Config) ReadAll

func (cfg *Config) ReadAll(path string) error

ReadAll reads the config file and the environment variables.

func (*Config) ReadEnv

func (cfg *Config) ReadEnv() error

ReadEnv reads the environment variables.

func (*Config) ReadFile

func (cfg *Config) ReadFile(path string) error

ReadFile reads the config file.

func (*Config) WriteFile

func (cfg *Config) WriteFile(path string) error

WriteFile writes the config file.

Jump to

Keyboard shortcuts

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