peterbourgon / ff

Flags-first package for configuration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

different style of flag separator can conflict with env var

dolanor opened this issue · comments

I'm still working on #66 and writing tests for the separator replacer, I figured there were no tests about it in the original PlainParser implementation. (I figured out when trying to implement the comment)

The problem I'm talking about is:

  • A user defines 2 flags: -s.1 and -s-1
  • User sets an env var to S_1

-> Should it set -s.1 or -s-1?

I don't consider it valid to have to have two discrete flags s.1 and s-1.

So do I. But currently, it is possible. Should ff panic if somebody does that ?
If not, going from env var to a flag will be in order of replacer and I guess keep the first one. Would that be okay then ?

Yeah, I would just ignore this case, personally.