fix config file parse err
This commit is contained in:
12
app/task.go
12
app/task.go
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user