25 lines
480 B
Go
25 lines
480 B
Go
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
|
|
}
|