figaro icon indicating copy to clipboard operation
figaro copied to clipboard

Should blank values be considered as "set"?

Open laserlemon opened this issue 11 years ago • 2 comments

If the value for a given ENV key is set to "", should that value be considered as being set?

ENV["foo"] = ""

Figaro.env.foo? # => true or false
Figaro.env.foo! # => "", nil or Figaro::MissingKey
Figaro.env.foo # => "" or nil

The current behavior is (and always has been) that a blank string is a valid value and counts as having been intentionally set to that value.

laserlemon avatar Apr 17 '14 19:04 laserlemon

I think there's no single use case when empty string is useful input.

I'd go with pragmatic approach and treat ? methods just as blank? in rails.

sheerun avatar Aug 09 '14 01:08 sheerun

To keep my code clean I'm wanting to use Figaro.env.feature_enabled? to decide whether or not a feature should be used in a particular environment. That seems to be the nicest way to use it. However if it's set to "true" somewhere, and I want to quickly override it by doing heroku config:set feature_enabled=#### I can't find anything to set it to to make that flip to false and quickly disable the feature. This would at least give me an option to do that.

glennfu avatar Sep 24 '14 19:09 glennfu