summaryrefslogtreecommitdiff
path: root/app/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/config.go')
-rw-r--r--app/config.go25
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
+}