fix config file parse err

This commit is contained in:
zu1k
2020-08-14 08:14:21 +08:00
parent 956910881e
commit 0d30186ea4

View File

@@ -5,10 +5,12 @@ import (
"io/ioutil"
"log"
"math/rand"
"os"
"strconv"
"sync"
"github.com/zu1k/proxypool/config"
"gopkg.in/yaml.v2"
"github.com/zu1k/proxypool/app/cache"
"github.com/zu1k/proxypool/provider"
"github.com/zu1k/proxypool/proxy"
@@ -76,12 +78,10 @@ func FetchNewConfigFileThenInit() {
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
err = yaml.Unmarshal(body, &config.SourceConfig)
if err != nil {
return
}
err = ioutil.WriteFile("source.yaml", body, os.ModePerm)
if err != nil {
return
}
InitConfigAndGetters("source.yaml")
InitGetters(config.SourceConfig.Sources)
}