config

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitRepo = "krau/SaveAny-Bot"
)

Variables

View Source
var (
	Version   string = "dev"
	BuildTime string = "unknown"
	GitCommit string = "unknown"
	Docker    string = "false" // whether built inside Docker
)

inject version by '-X' flag go build -ldflags "-X github.com/krau/SaveAny-Bot/config.Version=${{ env.VERSION }}"

Functions

func GetConfigFile added in v0.45.0

func GetConfigFile(cmd *cobra.Command) string

func Init

func Init(ctx context.Context, configFile ...string) error

func RegisterFlags added in v0.45.0

func RegisterFlags(cmd *cobra.Command)

Types

type Config

type Config struct {
	Lang         string      `toml:"lang" mapstructure:"lang" json:"lang"`
	Workers      int         `toml:"workers" mapstructure:"workers"`
	Retry        int         `toml:"retry" mapstructure:"retry"`
	NoCleanCache bool        `toml:"no_clean_cache" mapstructure:"no_clean_cache" json:"no_clean_cache"`
	Threads      int         `toml:"threads" mapstructure:"threads" json:"threads"`
	Stream       bool        `toml:"stream" mapstructure:"stream" json:"stream"`
	Proxy        string      `toml:"proxy" mapstructure:"proxy" json:"proxy"`
	Aria2        aria2Config `toml:"aria2" mapstructure:"aria2" json:"aria2"`

	Cache    cacheConfig             `toml:"cache" mapstructure:"cache" json:"cache"`
	Users    []userConfig            `toml:"users" mapstructure:"users" json:"users"`
	Temp     tempConfig              `toml:"temp" mapstructure:"temp"`
	DB       dbConfig                `toml:"db" mapstructure:"db"`
	Telegram telegramConfig          `toml:"telegram" mapstructure:"telegram"`
	Storages []storage.StorageConfig `toml:"-" mapstructure:"-" json:"storages"`
	Parser   parserConfig            `toml:"parser" mapstructure:"parser" json:"parser"`
	Hook     hookConfig              `toml:"hook" mapstructure:"hook" json:"hook"`
}

func C added in v0.29.3

func C() Config

func (Config) GetParserConfigByName added in v0.29.3

func (c Config) GetParserConfigByName(name string) map[string]any

func (Config) GetStorageByName added in v0.11.0

func (c Config) GetStorageByName(name string) storage.StorageConfig

func (Config) GetStorageNamesByUserID added in v0.11.0

func (c Config) GetStorageNamesByUserID(userID int64) []string

func (Config) GetUsersID added in v0.11.0

func (c Config) GetUsersID() []int64

func (Config) HasStorage added in v0.11.0

func (c Config) HasStorage(userID int64, storageName string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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