TelegramRepostBot/config/config.go
2023-08-01 15:09:19 +02:00

23 lines
438 B
Go

package config
import (
"fmt"
"github.com/caarlos0/env"
)
type Config struct {
ApiToken string `env:"API_TOKEN"`
GroupID int64 `env:"GROUP_ID"`
ChannelID int64 `env:"CHANNEL_ID"`
LogLevel string `env:"LOG_LVL" envDefault:"info"`
}
func LoadConfig() (*Config, error) {
config := &Config{}
if err := env.Parse(config); err != nil {
return nil, fmt.Errorf("error parsing configuration: %w", err)
}
return config, nil
}