bookmate/config/config.go
2025-07-13 16:37:05 +05:00

29 lines
481 B
Go

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
}