Class: DotNetServicesEnvironment

Inherits:
Object
  • Object
show all
Defined in:
lib/common/dot_net_services_environment.rb

Overview

The environment can be set in environment.properties file

Constant Summary collapse

ENV_FILE =
File.join(File.dirname(__FILE__), "environment.yml")
HOST_NAME_CONFIG_FILE =
File.join(File.dirname(__FILE__), "host_name_config.yml")
ENCODING =
"UTF-8"
HOST_NAMES =

Default env is set to bvt during development, will be changed to prod at the time of release

YAML.load(File.open(HOST_NAME_CONFIG_FILE))["environments"]

Class Method Summary collapse

Class Method Details

.acm_host_name(env = nil) ⇒ Object



42
43
44
# File 'lib/common/dot_net_services_environment.rb', line 42

def acm_host_name(env = nil)
  HOST_NAMES[valid_env(env)]['acm']
end

.environmentObject

Returns the environment from the environment.yml file



37
38
39
40
# File 'lib/common/dot_net_services_environment.rb', line 37

def environment
  environment = YAML.load(File.open(ENV_FILE))
  (environment && environment['Environment'])
end

.service_bus_host_name(env = nil) ⇒ Object



50
51
52
# File 'lib/common/dot_net_services_environment.rb', line 50

def service_bus_host_name(env = nil)
  HOST_NAMES[valid_env(env)]['service_bus']
end

.sts_host_name(env = nil) ⇒ Object



46
47
48
# File 'lib/common/dot_net_services_environment.rb', line 46

def sts_host_name(env = nil)
  HOST_NAMES[valid_env(env)]['sts']
end

.valid_env(env) ⇒ Object



54
55
56
57
# File 'lib/common/dot_net_services_environment.rb', line 54

def valid_env(env)
  env ||= environment
  HOST_NAMES.keys.include?(env) ? env : 'default'
end