Class: StaticRails::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/static-rails/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



28
29
30
31
32
33
34
# File 'lib/static-rails/configuration.rb', line 28

def initialize
  @sites = []
  @proxy_requests = !Rails.env.production?
  @serve_compiled_assets = Rails.env.production?
  @ping_server_timeout = 5
  @set_csrf_token_cookie = false
end

Instance Attribute Details

#appObject

When Rails invokes our Railtie, we’ll save off a reference to the Rails app



14
15
16
# File 'lib/static-rails/configuration.rb', line 14

def app
  @app
end

#ping_server_timeoutObject

Number of seconds to wait on sites to confirm servers are ready



23
24
25
# File 'lib/static-rails/configuration.rb', line 23

def ping_server_timeout
  @ping_server_timeout
end

#proxy_requestsObject

When true, our middleware will proxy requests to static site servers



17
18
19
# File 'lib/static-rails/configuration.rb', line 17

def proxy_requests
  @proxy_requests
end

#serve_compiled_assetsObject

When true, our middleware will serve sites’ compiled asset files



20
21
22
# File 'lib/static-rails/configuration.rb', line 20

def serve_compiled_assets
  @serve_compiled_assets
end

When true, a cookie named “_csrf_token” will be set by static-rails middleware



26
27
28
# File 'lib/static-rails/configuration.rb', line 26

def set_csrf_token_cookie
  @set_csrf_token_cookie
end

#sitesObject

Returns the value of attribute sites.



36
37
38
# File 'lib/static-rails/configuration.rb', line 36

def sites
  @sites
end