This commit is contained in:
glitch 2025-07-13 16:37:05 +05:00
parent 2c094876c8
commit 9d890ea675
8 changed files with 92 additions and 0 deletions

29
config/config.go Normal file
View file

@ -0,0 +1,29 @@
package config
import (
toml "github.com/BurntSushi/toml"
)
type TelegramConfig struct {
APIKey string `toml:"api_key"`
AdminID string `toml:"admin_id"`
}
type StorageConfig struct {
Type string `toml:"type"`
Path string `toml:"path"`
}
type Config struct {
Telegram TelegramConfig
Storage StorageConfig
}
func LoadConfig(path string) (*Config, error) {
var cfg Config
_, err := toml.DecodeFile(path, &cfg)
if err != nil {
return nil, err
}
return &cfg, nil
}