dshaw / env

Herding invisible cats

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enumerate appropriate values? Validation rules?

clintandrewhall opened this issue · comments

I'm assuming the "1" values in the JSON file are just "truthy" values for now. What would you think of enumerating possible values? Perhaps even validation rules, (though that may be pushing it). For instance:

{
  'ENVIRONMENT' : {
    'values' : [ 'dev', 'prod', 'test' ]
  },
  'PORT' : {
    'validate' : function(value) {
      return value < 9999 && val > 1000;
    }
}

I don't think this validating impl "feels" right; it probably belongs in the biz logic, but there's something to be said for having it in the env spec for clarity. You get the idea. Thoughts?