fix proxy
This commit is contained in:
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user