From 092963e7a28a2d953e1c97d75cd8e4dab46d0fc1 Mon Sep 17 00:00:00 2001 From: zack olson Date: Fri, 16 Aug 2024 16:55:59 -0400 Subject: [PATCH] add WithIgnoreUndefined option to config parse --- pkg/launcher/options.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/launcher/options.go b/pkg/launcher/options.go index 3b5b7f3ce..d049705db 100644 --- a/pkg/launcher/options.go +++ b/pkg/launcher/options.go @@ -278,6 +278,7 @@ func ParseOptions(subcommandName string, args []string) (*Options, error) { ffOpts := []ff.Option{ ff.WithConfigFileFlag("config"), ff.WithConfigFileParser(ff.PlainParser), + ff.WithIgnoreUndefined(true), // silently discard any unknown options and keep parsing } // Windows doesn't really support environmental variables in quite @@ -290,6 +291,9 @@ func ParseOptions(subcommandName string, args []string) (*Options, error) { ffOpts = append(ffOpts, ff.WithEnvVarPrefix("KOLIDE_LAUNCHER")) } + // TODO for discussion - i suspect with WithIgnoreUndefined set we could + // check for and return errors here and that would be less confusing if there + // are ever other parsing issues. Currently we would have no idea ff.Parse(flagset, args, ffOpts...) // handle --version