Class: EndPointBlank::Configuration
- Inherits:
-
Object
- Object
- EndPointBlank::Configuration
- 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
-
#app_name ⇒ Object
Returns the name of the application.
-
#application_version ⇒ Object
Returns the value of attribute application_version.
-
#base_url ⇒ Object
Returns the configured base URL, falling back to the ENDPOINTBLANK_BASE_URL environment variable, then a built-in default.
-
#cache_ttl ⇒ Object
Returns the value of attribute cache_ttl.
-
#client_id ⇒ Object
Returns the configured client id, falling back to the ENDPOINTBLANK_CLIENT_ID environment variable when not explicitly set.
-
#client_secret ⇒ Object
Returns the configured client secret, falling back to the ENDPOINTBLANK_CLIENT_SECRET environment variable when not explicitly set.
-
#env_name ⇒ Object
Returns the configured environment name, falling back to the ENDPOINTBLANK_ENV environment variable when not explicitly set.
-
#log_base_url ⇒ Object
Returns the configured log base URL, falling back to the ENDPOINTBLANK_LOG_BASE_URL environment variable, then a built-in default.
-
#log_mode ⇒ Object
Returns the value of attribute log_mode.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#mask_hook ⇒ Object
Returns the value of attribute mask_hook.
-
#masking_rules ⇒ Object
Returns the value of attribute masking_rules.
-
#token_ttl ⇒ Object
Returns the value of attribute token_ttl.
-
#trust_proxy_headers ⇒ Object
Returns the value of attribute trust_proxy_headers.
-
#version_finder ⇒ Object
Returns the value of attribute version_finder.
-
#worker_count ⇒ Object
Returns the value of attribute worker_count.
Instance Method Summary collapse
- #access_token_url ⇒ Object
- #authorize_url ⇒ Object
- #endpoint_update_url ⇒ Object
- #errors_url ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #logs_url ⇒ Object
- #requests_url ⇒ Object
- #responses_url ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 23 24 25 26 27 |
# 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 @trust_proxy_headers = true end |
Instance Attribute Details
#app_name ⇒ Object
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.
92 93 94 95 96 97 98 99 100 |
# File 'lib/end_point_blank/configuration.rb', line 92 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_version ⇒ Object
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_url ⇒ Object
Returns the configured base URL, falling back to the ENDPOINTBLANK_BASE_URL environment variable, then a built-in default.
43 44 45 |
# File 'lib/end_point_blank/configuration.rb', line 43 def base_url @base_url || ENV["ENDPOINTBLANK_BASE_URL"] || "https://in.endpointblank.com" end |
#cache_ttl ⇒ Object
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_id ⇒ Object
Returns the configured client id, falling back to the ENDPOINTBLANK_CLIENT_ID environment variable when not explicitly set.
31 32 33 |
# File 'lib/end_point_blank/configuration.rb', line 31 def client_id @client_id || ENV["ENDPOINTBLANK_CLIENT_ID"] end |
#client_secret ⇒ Object
Returns the configured client secret, falling back to the ENDPOINTBLANK_CLIENT_SECRET environment variable when not explicitly set.
37 38 39 |
# File 'lib/end_point_blank/configuration.rb', line 37 def client_secret @client_secret || ENV["ENDPOINTBLANK_CLIENT_SECRET"] end |
#env_name ⇒ Object
Returns the configured environment name, falling back to the ENDPOINTBLANK_ENV environment variable when not explicitly set.
104 105 106 |
# File 'lib/end_point_blank/configuration.rb', line 104 def env_name @env_name || ENV["ENDPOINTBLANK_ENV"] end |
#log_base_url ⇒ Object
Returns the configured log base URL, falling back to the ENDPOINTBLANK_LOG_BASE_URL environment variable, then a built-in default.
49 50 51 |
# File 'lib/end_point_blank/configuration.rb', line 49 def log_base_url @log_base_url || ENV["ENDPOINTBLANK_LOG_BASE_URL"] || "https://log.endpointblank.com" end |
#log_mode ⇒ Object
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 |
#logger ⇒ Object
Returns the value of attribute logger.
16 17 18 |
# File 'lib/end_point_blank/configuration.rb', line 16 def logger @logger end |
#mask_hook ⇒ Object
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_rules ⇒ Object
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_ttl ⇒ Object
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 |
#trust_proxy_headers ⇒ Object
Returns the value of attribute trust_proxy_headers.
16 17 18 |
# File 'lib/end_point_blank/configuration.rb', line 16 def trust_proxy_headers @trust_proxy_headers end |
#version_finder ⇒ Object
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_count ⇒ Object
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_url ⇒ Object
57 58 59 |
# File 'lib/end_point_blank/configuration.rb', line 57 def access_token_url "#{base_url}/api/access_token" end |
#authorize_url ⇒ Object
61 62 63 |
# File 'lib/end_point_blank/configuration.rb', line 61 def "#{base_url}/api/authorize" end |
#endpoint_update_url ⇒ Object
53 54 55 |
# File 'lib/end_point_blank/configuration.rb', line 53 def endpoint_update_url "#{base_url}/api/application_updates" end |
#errors_url ⇒ Object
65 66 67 |
# File 'lib/end_point_blank/configuration.rb', line 65 def errors_url "#{log_base_url}/api/application_errors" end |
#logs_url ⇒ Object
77 78 79 |
# File 'lib/end_point_blank/configuration.rb', line 77 def logs_url "#{log_base_url}/api/application_logs" end |
#requests_url ⇒ Object
69 70 71 |
# File 'lib/end_point_blank/configuration.rb', line 69 def requests_url "#{log_base_url}/api/application_requests" end |
#responses_url ⇒ Object
73 74 75 |
# File 'lib/end_point_blank/configuration.rb', line 73 def responses_url "#{log_base_url}/api/application_responses" end |