1
0
mirror of https://github.com/fumiama/terasu-cloudflared.git synced 2026-06-16 08:20:24 +08:00

TUN-3475: Unify config file handling with typed config for new fields

This commit is contained in:
Igor Postelnik
2020-10-19 17:33:40 -05:00
parent 051908aaef
commit eaf03305bd
8 changed files with 333 additions and 258 deletions

View File

@@ -22,6 +22,7 @@ import (
"gopkg.in/yaml.v2"
"github.com/cloudflare/cloudflared/cmd/cloudflared/cliutil"
"github.com/cloudflare/cloudflared/cmd/cloudflared/config"
"github.com/cloudflare/cloudflared/logger"
"github.com/cloudflare/cloudflared/tunnelrpc/pogs"
"github.com/cloudflare/cloudflared/tunnelstore"
@@ -341,11 +342,8 @@ func runCommand(c *cli.Context) error {
}
tunnelRef := c.Args().First()
if tunnelRef == "" {
// attempt to read from the config file
if tunnelRef, err = sc.getConfigFileTunnelRef(); err != nil {
return err
}
// see if tunnel id was in the config file
tunnelRef = config.GetConfiguration().TunnelID
if tunnelRef == "" {
return cliutil.UsageError(`"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.`)
}