Fix: provider should fallback to read remote when local file invalid
This commit is contained in:
parent
dcf97ff5b4
commit
a55be58c01
1 changed files with 5 additions and 1 deletions
|
@ -128,7 +128,11 @@ func (pp *ProxySetProvider) Initial() error {
|
||||||
|
|
||||||
proxies, err := pp.parse(buf)
|
proxies, err := pp.parse(buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
// parse local file error, fallback to remote
|
||||||
|
buf, err = pp.vehicle.Read()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(pp.vehicle.Path(), buf, fileMode); err != nil {
|
if err := ioutil.WriteFile(pp.vehicle.Path(), buf, fileMode); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue