Module: Lab::Lims::Config
- Defined in:
- app/services/lab/lims/config.rb
Overview
Load LIMS’ configuration files
Defined Under Namespace
Classes: ConfigNotFound
Class Method Summary collapse
-
.application ⇒ Object
Returns LIMS’ application.yml configuration file.
- .config_file_name ⇒ Object
-
.couchdb ⇒ Object
Returns LIMS’ couchdb configuration file for the current environment (Rails.env).
-
.database ⇒ Object
Returns LIMS’ database.yml configuration file.
- .preferred_api ⇒ Object
- .rest_api ⇒ Object
- .updates_poll_frequency ⇒ Object
- .updates_socket ⇒ Object
Class Method Details
.application ⇒ Object
Returns LIMS’ application.yml configuration file
60 61 62 |
# File 'app/services/lab/lims/config.rb', line 60 def application @application ||= YAML.load_file(find_config_path(config_file_name)) end |
.config_file_name ⇒ Object
53 54 55 56 |
# File 'app/services/lab/lims/config.rb', line 53 def config_file_name # if nlims.yml exists return it, else return application.yml File.exist?(Rails.root.join('config', 'nlims.yml')) ? 'nlims.yml' : 'application.yml' end |
.couchdb ⇒ Object
Returns LIMS’ couchdb configuration file for the current environment (Rails.env)
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/services/lab/lims/config.rb', line 20 def couchdb config_path = begin find_config_path('couchdb.yml') rescue ConfigNotFound => e Rails.logger.error("Failed to find default LIMS couchdb config: #{e.}") find_config_path('couchdb-lims.yml') # This can be placed in HIS-EMR-API/config end Rails.logger.debug("Using LIMS couchdb config: #{config_path}") YAML.load_file(config_path)[Rails.env] end |
.database ⇒ Object
Returns LIMS’ database.yml configuration file
66 67 68 |
# File 'app/services/lab/lims/config.rb', line 66 def database @database ||= YAML.load_file(find_config_path('database.yml')) end |
.preferred_api ⇒ Object
14 15 16 |
# File 'app/services/lab/lims/config.rb', line 14 def preferred_api emr_api_application('lims_api') end |
.rest_api ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'app/services/lab/lims/config.rb', line 33 def rest_api @rest_api ||= { protocol: emr_api_application('lims_protocol', 'http'), host: emr_api_application('lims_host'), port: emr_api_application('lims_port'), username: emr_api_application('lims_username'), password: emr_api_application('lims_password') } end |
.updates_poll_frequency ⇒ Object
49 50 51 |
# File 'app/services/lab/lims/config.rb', line 49 def updates_poll_frequency 30 # Seconds end |
.updates_socket ⇒ Object
43 44 45 46 47 |
# File 'app/services/lab/lims/config.rb', line 43 def updates_socket @updates_socket ||= { 'url' => emr_api_application('lims_realtime_updates_url') } end |