Class: SoarEnvironment::EnvironmentValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/soar_environment/environment_validator.rb

Constant Summary collapse

VALID_EXECUTION_ENVIRONMENTS =
['production','development']

Instance Method Summary collapse

Instance Method Details

#validate(environment) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/soar_environment/environment_validator.rb', line 5

def validate(environment)
  errors = []
  errors << 'invalid service identifier' if (environment['IDENTIFIER'].nil?) or (environment['IDENTIFIER'].strip == "")
  errors << 'Missing execution environment indicator' if (environment['RACK_ENV'] == 'none') or (environment['RACK_ENV'].nil?) or (environment['RACK_ENV'].strip == "")
  errors << 'Invalid execution environment indicator' if not VALID_EXECUTION_ENVIRONMENTS.include?(environment['RACK_ENV'])
  errors
end