TUN-4116: Ingore credentials-file setting in configuration file during tunnel create and delete opeations.

This change has two parts:
1. Update to newer version of the urfave/cli fork that correctly sets flag value along the context hierarchy while respecting config file overide behavior of the most specific instance of the flag.
2. Redefine --credentials-file flag so that create and delete subcommand don't use value from the config file.
This commit is contained in:
Igor Postelnik
2021-03-23 21:52:14 -05:00
parent 12447677cf
commit 9018ee5d5e
20 changed files with 2498 additions and 180 deletions

View File

@@ -32,26 +32,8 @@ func setFlagsFromConfigFile(c *cli.Context) error {
return cli.Exit(err, errorExitCode)
}
if err := applyConfig(c, inputSource); err != nil {
if err := altsrc.ApplyInputSource(c, inputSource); err != nil {
return cli.Exit(err, errorExitCode)
}
return nil
}
func applyConfig(c *cli.Context, inputSource altsrc.InputSourceContext) error {
for _, context := range c.Lineage() {
if context.Command == nil {
// we've reached the placeholder root context not associated with the app
break
}
targetFlags := context.Command.Flags
if context.Command.Name == "" {
// commands that define child subcommands are executed as if they were an app
targetFlags = context.App.Flags
}
if err := altsrc.ApplyInputSourceValues(context, inputSource, targetFlags); err != nil {
return err
}
}
return nil
}