peterbourgon / ff

Flags-first package for configuration
Apache License 2.0
1.37k stars 59 forks source link

Should `Parse` fail on missing config file? #46

Closed Dragomir-Ivanov closed 4 years ago

Dragomir-Ivanov commented 4 years ago

Currently if ff is configured for using config file:

ff.Parse(fs, os.Args[1:], 
ff.WithConfigFile(appName+".conf"),
ff.WithConfigFileParser(ff.PlainParser))

And if that config file is missing, Parse fails. However it might be perfectly valid state, using defaults for the flags, and failing only if there is no default value for given flag.

peterbourgon commented 4 years ago

I think it's totally reasonable to have an option to control this behavior, e.g. func WithAllowMissingConfigFile(allow bool) Option — default false to preserve current behavior.

Dragomir-Ivanov commented 4 years ago

Thanks @peterbourgon . Will make a PR in next couple of days. Cheers!

johnrichardrinehart commented 4 years ago

@Dragomir-Ivanov it seems that you've implemented said functionality. Are you still willing and able to submit a PR?

peterbourgon commented 4 years ago

Oops, this is done, the issue should have been closed.

johnrichardrinehart commented 4 years ago

I see. My mistake. Carry on, @Dragomir-Ivanov!

Dragomir-Ivanov commented 4 years ago

No worries @johnrichardrinehart. Cheers!