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.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#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.
-
#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 |
# 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_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.
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_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.
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_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.
30 31 32 |
# File 'lib/end_point_blank/configuration.rb', line 30 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.
36 37 38 |
# File 'lib/end_point_blank/configuration.rb', line 36 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.
103 104 105 |
# File 'lib/end_point_blank/configuration.rb', line 103 def env_name @env_name || ENV["ENDPOINTBLANK_ENV"] end |
#environment ⇒ Object
Returns the value of attribute environment.
16 17 18 |
# File 'lib/end_point_blank/configuration.rb', line 16 def environment @environment 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.
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_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 |
#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
56 57 58 |
# File 'lib/end_point_blank/configuration.rb', line 56 def access_token_url "#{base_url}/api/access_token" end |
#authorize_url ⇒ Object
60 61 62 |
# File 'lib/end_point_blank/configuration.rb', line 60 def "#{base_url}/api/authorize" end |
#endpoint_update_url ⇒ Object
52 53 54 |
# File 'lib/end_point_blank/configuration.rb', line 52 def endpoint_update_url "#{base_url}/api/application_updates" end |
#errors_url ⇒ Object
64 65 66 |
# File 'lib/end_point_blank/configuration.rb', line 64 def errors_url "#{log_base_url}/api/application_errors" end |
#logs_url ⇒ Object
76 77 78 |
# File 'lib/end_point_blank/configuration.rb', line 76 def logs_url "#{log_base_url}/api/application_logs" end |
#requests_url ⇒ Object
68 69 70 |
# File 'lib/end_point_blank/configuration.rb', line 68 def requests_url "#{log_base_url}/api/application_requests" end |
#responses_url ⇒ Object
72 73 74 |
# File 'lib/end_point_blank/configuration.rb', line 72 def responses_url "#{log_base_url}/api/application_responses" end |