1
0
mirror of https://github.com/fumiama/terasu-cloudflared.git synced 2026-06-08 03:55:11 +08:00

TUN-3464: Newtype to wrap []ingress.Rule

This commit is contained in:
Adam Chalmers
2020-10-15 12:41:50 -05:00
parent 4a4a1bb6b1
commit c96b9e8d8f
5 changed files with 59 additions and 50 deletions

View File

@@ -196,15 +196,15 @@ func ValidateUrl(c *cli.Context, allowFromArgs bool) (string, error) {
return validUrl, err
}
func ReadRules(c *cli.Context) ([]ingress.Rule, error) {
func ReadRules(c *cli.Context) (ingress.Ingress, error) {
configFilePath := c.String("config")
if configFilePath == "" {
return nil, ErrNoConfigFile
return ingress.Ingress{}, ErrNoConfigFile
}
fmt.Printf("Reading from config file %s\n", configFilePath)
configBytes, err := ioutil.ReadFile(configFilePath)
if err != nil {
return nil, err
return ingress.Ingress{}, err
}
rules, err := ingress.ParseIngress(configBytes)
return rules, err