Class: Shugoi::Rails::Configuration
- Inherits:
-
Object
- Object
- Shugoi::Rails::Configuration
- Defined in:
- lib/shugoi/rails/configuration.rb
Overview
Configuration globale pour Rails (équivalent de ShugoiCoreOptions).
Instance Attribute Summary collapse
-
#allowlist ⇒ Object
Returns the value of attribute allowlist.
-
#auto_inject ⇒ Object
Returns the value of attribute auto_inject.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#block_page ⇒ Object
Returns the value of attribute block_page.
-
#block_status ⇒ Object
Returns the value of attribute block_status.
-
#bot_whitelist ⇒ Object
Returns the value of attribute bot_whitelist.
-
#csp ⇒ Object
Returns the value of attribute csp.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#extra_directives ⇒ Object
Returns the value of attribute extra_directives.
-
#headless_patterns ⇒ Object
Returns the value of attribute headless_patterns.
-
#internal_url ⇒ Object
Returns the value of attribute internal_url.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#multi_process ⇒ Object
Returns the value of attribute multi_process.
-
#pow_difficulty ⇒ Object
Returns the value of attribute pow_difficulty.
-
#pow_ttl_ms ⇒ Object
Returns the value of attribute pow_ttl_ms.
-
#restricted_access ⇒ Object
Returns the value of attribute restricted_access.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#signing_secret ⇒ Object
Returns the value of attribute signing_secret.
-
#site_key ⇒ Object
Returns the value of attribute site_key.
-
#split_render ⇒ Object
Returns the value of attribute split_render.
-
#verify_bots ⇒ Object
Returns the value of attribute verify_bots.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #to_options ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/shugoi/rails/configuration.rb', line 13 def initialize @site_key = ENV["SHUGOI_SITE_KEY"] @secret = ENV["SHUGOI_SECRET"] @signing_secret = ENV["SHUGOI_SIGNING_SECRET"] || ENV["SHUGOKI_SIGNING_SECRET"] @allowlist = ["/api", "/legal"] @headless_patterns = Shugoi::DEFAULT_HEADLESS_PATTERNS @bot_whitelist = Shugoi::DEFAULT_BOT_WHITELIST @base_url = ENV["SHUGOI_BASE_URL"] || "https://shugoi.com/api/v1" @internal_url = nil @debug = false @auto_inject = true @restricted_access = false @extra_directives = {} @csp = true @block_status = 403 @locale = nil @block_page = nil @split_render = true @multi_process = false @verify_bots = true @pow_difficulty = 10 @pow_ttl_ms = 120_000 end |
Instance Attribute Details
#allowlist ⇒ Object
Returns the value of attribute allowlist.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def allowlist @allowlist end |
#auto_inject ⇒ Object
Returns the value of attribute auto_inject.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def auto_inject @auto_inject end |
#base_url ⇒ Object
Returns the value of attribute base_url.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def base_url @base_url end |
#block_page ⇒ Object
Returns the value of attribute block_page.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def block_page @block_page end |
#block_status ⇒ Object
Returns the value of attribute block_status.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def block_status @block_status end |
#bot_whitelist ⇒ Object
Returns the value of attribute bot_whitelist.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def bot_whitelist @bot_whitelist end |
#csp ⇒ Object
Returns the value of attribute csp.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def csp @csp end |
#debug ⇒ Object
Returns the value of attribute debug.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def debug @debug end |
#extra_directives ⇒ Object
Returns the value of attribute extra_directives.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def extra_directives @extra_directives end |
#headless_patterns ⇒ Object
Returns the value of attribute headless_patterns.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def headless_patterns @headless_patterns end |
#internal_url ⇒ Object
Returns the value of attribute internal_url.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def internal_url @internal_url end |
#locale ⇒ Object
Returns the value of attribute locale.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def locale @locale end |
#multi_process ⇒ Object
Returns the value of attribute multi_process.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def multi_process @multi_process end |
#pow_difficulty ⇒ Object
Returns the value of attribute pow_difficulty.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def pow_difficulty @pow_difficulty end |
#pow_ttl_ms ⇒ Object
Returns the value of attribute pow_ttl_ms.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def pow_ttl_ms @pow_ttl_ms end |
#restricted_access ⇒ Object
Returns the value of attribute restricted_access.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def restricted_access @restricted_access end |
#secret ⇒ Object
Returns the value of attribute secret.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def secret @secret end |
#signing_secret ⇒ Object
Returns the value of attribute signing_secret.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def signing_secret @signing_secret end |
#site_key ⇒ Object
Returns the value of attribute site_key.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def site_key @site_key end |
#split_render ⇒ Object
Returns the value of attribute split_render.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def split_render @split_render end |
#verify_bots ⇒ Object
Returns the value of attribute verify_bots.
7 8 9 |
# File 'lib/shugoi/rails/configuration.rb', line 7 def verify_bots @verify_bots end |
Instance Method Details
#to_options ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/shugoi/rails/configuration.rb', line 37 def { site_key: @site_key, secret: @secret, signing_secret: @signing_secret, allowlist: @allowlist, headless_patterns: @headless_patterns, bot_whitelist: @bot_whitelist, base_url: @base_url, internal_url: @internal_url, debug: @debug, auto_inject: @auto_inject, restricted_access: @restricted_access, extra_directives: @extra_directives, csp: @csp, block_status: @block_status, locale: @locale, block_page: @block_page, split_render: @split_render, multi_process: @multi_process, verify_bots: @verify_bots, pow_difficulty: @pow_difficulty, pow_ttl_ms: @pow_ttl_ms }.reject { |_, v| v.nil? } end |