class Nginx::ServerBlock
Attributes
accel_location[R]
domain[R]
listen[R]
location[R]
server[R]
upstream[R]
Public Class Methods
new(upstream: nil, server: nil, listen: nil, location: nil, accel_location: nil, domain: nil)
click to toggle source
# File lib/shared_infrastructure/nginx/server_block.rb, line 7 def initialize(upstream: nil, server: nil, listen: nil, location: nil, accel_location: nil, domain: nil) @accel_location = accel_location @domain = domain @listen = listen @location = Array(location) @server = server @upstream = upstream end
Public Instance Methods
to_s()
click to toggle source
# File lib/shared_infrastructure/nginx/server_block.rb, line 16 def to_s [ upstream_string, server_block_string ].compact.join("\n\n") end
Private Instance Methods
server_block_string()
click to toggle source
# File lib/shared_infrastructure/nginx/server_block.rb, line 25 def server_block_string <<~SERVER_BLOCK server { #{[ @server&.to_s(1), @listen&.to_s(1), @accel_location&.proxy_set_header(server.domain.domain_name), @location&.map { |l| l.to_s(1) } ].compact.join("\n\n")} } SERVER_BLOCK end
upstream_string()
click to toggle source
# File lib/shared_infrastructure/nginx/server_block.rb, line 38 def upstream_string upstream&.to_s end