diff options
author | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-06-27 02:20:00 +0300 |
---|---|---|
committer | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-06-27 02:20:00 +0300 |
commit | 12ef16cbeef97b58a5e660230eaa84ceb80afdbc (patch) | |
tree | a4ca8b8a5ed07b8406467f1919e2d76fd44c7952 /app/config.go |
first commit
Diffstat (limited to 'app/config.go')
-rw-r--r-- | app/config.go | 25 |
1 files changed, 25 insertions, 0 deletions
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 +} |