fix proxy

This commit is contained in:
2022-05-01 19:13:27 -04:00
parent 38e964c522
commit 5e55fea0fd
6 changed files with 72 additions and 14 deletions

View File

@ -22,6 +22,8 @@ func Run(configPath string) {
}
}()
// tgram := NewTelegramSender(cfg.TelegramProxy)
for _, feed := range cfg.Feeds {
log.Info("processing feed", "feed", feed.Name)
ProcessFeed(feed, scheduler, cfg.DbDir)

View File

@ -17,6 +17,8 @@ type FeedCfg struct {
}
type Config struct {
Proxy string `yaml:"proxy"`
TelegramProxy string `yaml:"telegram_proxy"`
DataDir string `yaml:"data_dir"`
LastSuccessPath string `yaml:"last_loaded_path"`
DbDir string `yaml:"db_dir"`
@ -49,5 +51,24 @@ func ParseConfig(configPath string) (*Config, error) {
c.DbDir = path.Join(c.DataDir, "feed_data")
}
if c.Proxy != "" {
if c.TelegramProxy == "" {
c.TelegramProxy = c.Proxy
}
for i, _ := range c.Feeds {
feedCfg := &c.Feeds[i]
if feedCfg.Proxy == "" {
feedCfg.Proxy = c.Proxy
}
}
}
for i, _ := range c.Feeds {
feedCfg := &c.Feeds[i]
if feedCfg.Proxy == "NONE" {
feedCfg.Proxy = ""
}
}
return &c, nil
}