1
0
mirror of https://github.com/fumiama/terasu-cloudflared.git synced 2026-06-07 19:10:26 +08:00

TUN-3558: cloudflared allows empty config files

This commit is contained in:
Adam Chalmers
2020-11-18 10:18:08 -06:00
parent 4c1b89576c
commit b7e91466f5
3 changed files with 14 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ package config
import (
"fmt"
"io"
"net/url"
"os"
"path/filepath"
@@ -392,6 +393,10 @@ func ReadConfigFile(c *cli.Context, log logger.Service) (*configFileSettings, er
}
defer file.Close()
if err := yaml.NewDecoder(file).Decode(&configuration); err != nil {
if err == io.EOF {
log.Errorf("Configuration file %s was empty", configFile)
return &configuration, nil
}
return nil, errors.Wrap(err, "error parsing YAML in config file at "+configFile)
}
configuration.sourceFile = configFile