Module: Opener::Webservice::Configuration

Defined in:
lib/opener/webservice/configuration.rb

Overview

Module for storing global configuration settings such as whether or not to enable authentication.

Class Method Summary collapse

Class Method Details

.authentication?TrueClass|FalseClass

Returns ‘true` if authentication should be enabled.

Returns:

  • (TrueClass|FalseClass)


13
14
15
# File 'lib/opener/webservice/configuration.rb', line 13

def self.authentication?
  return !!authentication_endpoint && !authentication_endpoint.empty?
end

.authentication_endpointString

Returns the authentication endpoint to use.

Returns:

  • (String)


22
23
24
# File 'lib/opener/webservice/configuration.rb', line 22

def self.authentication_endpoint
  return ENV['AUTHENTICATION_ENDPOINT']
end

.authentication_secretString

Returns the field name of the authentication secret.

Returns:

  • (String)


31
32
33
# File 'lib/opener/webservice/configuration.rb', line 31

def self.authentication_secret
  return ENV['AUTHENTICATION_SECRET'] || 'secret'
end

.authentication_tokenString

Returns the field name of the authentication token.

Returns:

  • (String)


40
41
42
# File 'lib/opener/webservice/configuration.rb', line 40

def self.authentication_token
  return ENV['AUTHENTICATION_TOKEN'] || 'token'
end

.configure_rollbarObject

Configures Rollbar.



74
75
76
77
78
79
80
# File 'lib/opener/webservice/configuration.rb', line 74

def self.configure_rollbar
  Rollbar.configure do |config|
    config.access_token = ENV['ROLLBAR_TOKEN']
    config.enabled      = rollbar?
    config.environment  = environment
  end
end

.environmentString

Returns:

  • (String)


85
86
87
# File 'lib/opener/webservice/configuration.rb', line 85

def self.environment
  return ENV['RACK_ENV'] || ENV['RAILS_ENV']
end

.output_bucketString

Name of the S3 bucket to store output in.

Returns:

  • (String)


49
50
51
# File 'lib/opener/webservice/configuration.rb', line 49

def self.output_bucket
  return ENV['OUTPUT_BUCKET']
end

.rollbar?TrueClass|FalseClass

Returns ‘true` if Rollbar error tracking should be enabled.

Returns:

  • (TrueClass|FalseClass)


67
68
69
# File 'lib/opener/webservice/configuration.rb', line 67

def self.rollbar?
  return !!ENV['ROLLBAR_TOKEN']
end

.syslog?TrueClass|FalseClass

Returns ‘true` if Syslog should be enabled.

Returns:

  • (TrueClass|FalseClass)


58
59
60
# File 'lib/opener/webservice/configuration.rb', line 58

def self.syslog?
  return !!ENV['ENABLE_SYSLOG'] && !ENV['ENABLE_SYSLOG'].empty?
end