Class: EndPointBlank::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/end_point_blank/configuration.rb

Overview

Singleton configuration object for the EndPointBlank client.

Values may be set explicitly via configure. Several settings also fall back to ENDPOINTBLANK_* environment variables when not explicitly configured, in order to support Rails-free deployments.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



20
21
22
23
24
25
26
# File 'lib/end_point_blank/configuration.rb', line 20

def initialize
  @worker_count = 4
  @token_ttl = nil
  @cache_ttl = 300
  @masking_rules = []
  @mask_hook = nil
end

Instance Attribute Details

#app_nameObject

Returns the name of the application.

If #app_name= is called, then that value is returned.

Otherwise, falls back to the ENDPOINTBLANK_APP_NAME environment variable.

Otherwise, if the application is a Rails application, then Rails.application.name is returned.

Otherwise, nil is returned.



91
92
93
94
95
96
97
98
99
# File 'lib/end_point_blank/configuration.rb', line 91

def app_name
  if @app_name
    @app_name
  elsif ENV["ENDPOINTBLANK_APP_NAME"]
    ENV["ENDPOINTBLANK_APP_NAME"]
  elsif defined?(::Rails)
    ::Rails.application.name.underscore
  end
end

#application_versionObject

Returns the value of attribute application_version.



16
17
18
# File 'lib/end_point_blank/configuration.rb', line 16

def application_version
  @application_version
end

#base_urlObject

Returns the configured base URL, falling back to the ENDPOINTBLANK_BASE_URL environment variable, then a built-in default.



42
43
44
# File 'lib/end_point_blank/configuration.rb', line 42

def base_url
  @base_url || ENV["ENDPOINTBLANK_BASE_URL"] || "https://in.endpointblank.com"
end

#cache_ttlObject

Returns the value of attribute cache_ttl.



16
17
18
# File 'lib/end_point_blank/configuration.rb', line 16

def cache_ttl
  @cache_ttl
end

#client_idObject

Returns the configured client id, falling back to the ENDPOINTBLANK_CLIENT_ID environment variable when not explicitly set.



30
31
32
# File 'lib/end_point_blank/configuration.rb', line 30

def client_id
  @client_id || ENV["ENDPOINTBLANK_CLIENT_ID"]
end

#client_secretObject

Returns the configured client secret, falling back to the ENDPOINTBLANK_CLIENT_SECRET environment variable when not explicitly set.



36
37
38
# File 'lib/end_point_blank/configuration.rb', line 36

def client_secret
  @client_secret || ENV["ENDPOINTBLANK_CLIENT_SECRET"]
end

#env_nameObject

Returns the configured environment name, falling back to the ENDPOINTBLANK_ENV environment variable when not explicitly set.



103
104
105
# File 'lib/end_point_blank/configuration.rb', line 103

def env_name
  @env_name || ENV["ENDPOINTBLANK_ENV"]
end

#environmentObject

Returns the value of attribute environment.



16
17
18
# File 'lib/end_point_blank/configuration.rb', line 16

def environment
  @environment
end

#log_base_urlObject

Returns the configured log base URL, falling back to the ENDPOINTBLANK_LOG_BASE_URL environment variable, then a built-in default.



48
49
50
# File 'lib/end_point_blank/configuration.rb', line 48

def log_base_url
  @log_base_url || ENV["ENDPOINTBLANK_LOG_BASE_URL"] || "https://log.endpointblank.com"
end

#log_modeObject

Returns the value of attribute log_mode.



16
17
18
# File 'lib/end_point_blank/configuration.rb', line 16

def log_mode
  @log_mode
end

#loggerObject

Returns the value of attribute logger.



16
17
18
# File 'lib/end_point_blank/configuration.rb', line 16

def logger
  @logger
end

#mask_hookObject

Returns the value of attribute mask_hook.



16
17
18
# File 'lib/end_point_blank/configuration.rb', line 16

def mask_hook
  @mask_hook
end

#masking_rulesObject

Returns the value of attribute masking_rules.



16
17
18
# File 'lib/end_point_blank/configuration.rb', line 16

def masking_rules
  @masking_rules
end

#token_ttlObject

Returns the value of attribute token_ttl.



16
17
18
# File 'lib/end_point_blank/configuration.rb', line 16

def token_ttl
  @token_ttl
end

#version_finderObject

Returns the value of attribute version_finder.



16
17
18
# File 'lib/end_point_blank/configuration.rb', line 16

def version_finder
  @version_finder
end

#worker_countObject

Returns the value of attribute worker_count.



16
17
18
# File 'lib/end_point_blank/configuration.rb', line 16

def worker_count
  @worker_count
end

Instance Method Details

#access_token_urlObject



56
57
58
# File 'lib/end_point_blank/configuration.rb', line 56

def access_token_url
  "#{base_url}/api/access_token"
end

#authorize_urlObject



60
61
62
# File 'lib/end_point_blank/configuration.rb', line 60

def authorize_url
  "#{base_url}/api/authorize"
end

#endpoint_update_urlObject



52
53
54
# File 'lib/end_point_blank/configuration.rb', line 52

def endpoint_update_url
  "#{base_url}/api/application_updates"
end

#errors_urlObject



64
65
66
# File 'lib/end_point_blank/configuration.rb', line 64

def errors_url
  "#{log_base_url}/api/application_errors"
end

#logs_urlObject



76
77
78
# File 'lib/end_point_blank/configuration.rb', line 76

def logs_url
  "#{log_base_url}/api/application_logs"
end

#requests_urlObject



68
69
70
# File 'lib/end_point_blank/configuration.rb', line 68

def requests_url
  "#{log_base_url}/api/application_requests"
end

#responses_urlObject



72
73
74
# File 'lib/end_point_blank/configuration.rb', line 72

def responses_url
  "#{log_base_url}/api/application_responses"
end