1
0
mirror of https://github.com/fumiama/terasu-cloudflared.git synced 2026-06-07 01:50:23 +08:00

TUN-1086: fixed config option

This commit is contained in:
Austin Cherry
2018-10-05 14:58:21 -05:00
parent 71b113cad3
commit 5cd4fab9dd
2 changed files with 23 additions and 40 deletions

View File

@@ -8,7 +8,6 @@ import (
"golang.org/x/crypto/ssh/terminal"
"github.com/cloudflare/cloudflared/cmd/cloudflared/access"
"github.com/cloudflare/cloudflared/cmd/cloudflared/config"
"github.com/cloudflare/cloudflared/cmd/cloudflared/tunnel"
"github.com/cloudflare/cloudflared/cmd/cloudflared/updater"
"github.com/cloudflare/cloudflared/log"
@@ -17,7 +16,6 @@ import (
"github.com/getsentry/raven-go"
"github.com/mitchellh/go-homedir"
"gopkg.in/urfave/cli.v2"
"gopkg.in/urfave/cli.v2/altsrc"
"github.com/pkg/errors"
)
@@ -56,7 +54,7 @@ func main() {
and configure access control.`
app.Flags = flags()
app.Action = action(Version, shutdownC, graceShutdownC)
app.Before = before(app.Flags)
app.Before = tunnel.Before
app.Commands = commands()
tunnel.Init(Version, shutdownC, graceShutdownC) // we need this to support the tunnel sub command...
@@ -105,24 +103,6 @@ func action(version string, shutdownC, graceShutdownC chan struct{}) cli.ActionF
}
}
func before(flags []cli.Flag) cli.BeforeFunc {
return func(context *cli.Context) error {
inputSource, err := config.FindInputSourceContext(context)
if err != nil {
logger.WithError(err).Infof("Cannot load configuration from %s", context.String("config"))
return err
} else if inputSource != nil {
err := altsrc.ApplyInputSourceValues(context, inputSource, flags)
if err != nil {
logger.WithError(err).Infof("Cannot apply configuration from %s", context.String("config"))
return err
}
logger.Infof("Applied configuration from %s", context.String("config"))
}
return nil
}
}
func userHomeDir() (string, error) {
// This returns the home dir of the executing user using OS-specific method
// for discovering the home dir. It's not recommended to call this function