From 12ef16cbeef97b58a5e660230eaa84ceb80afdbc Mon Sep 17 00:00:00 2001 From: Alexander NeonXP Kiryukhin Date: Thu, 27 Jun 2024 02:20:00 +0300 Subject: first commit --- app/config.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 app/config.go (limited to 'app/config.go') diff --git a/app/config.go b/app/config.go new file mode 100644 index 0000000..66531aa --- /dev/null +++ b/app/config.go @@ -0,0 +1,25 @@ +package app + +import ( + "gitrepo.ru/neonxp/rss2world/internal/rss" + "gitrepo.ru/neonxp/rss2world/internal/telegram" + + "github.com/caarlos0/env/v11" +) + +type Config struct { + RSS *rss.Config + Telegram *telegram.Config +} + +func NewConfig() (*Config, error) { + cfg := &Config{RSS: &rss.Config{}, Telegram: &telegram.Config{}} + if err := env.Parse(cfg.RSS); err != nil { + return nil, err + } + if err := env.Parse(cfg.Telegram); err != nil { + return nil, err + } + + return cfg, nil +} -- cgit v1.2.3