bkeepers / envy

a schema for your application's environment variables

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Principle of least surprise for variable blocks

laserlemon opened this issue · comments

Currently, a block given to a variable declaration is used to determine the default value for that variable. Might we confine dynamically computed default values to passing a proc as the :default option. That would open up the block syntax to be used for dynamic value parsing.

For instance, if you have one environment variable that's stored as a comma-separated list of numbers, instead of defining a new variable class for that one value, you could instead:

variable :admin_ids do |value|
  value.split(",").map(&:to_i)
end