Class: Nginx::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/shared_infrastructure/nginx/nginx.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root = nil) ⇒ Configuration

Returns a new instance of Configuration.



15
16
17
18
# File 'lib/shared_infrastructure/nginx/nginx.rb', line 15

def initialize(root = nil)
  @dhparam = 2048
  @root = root
end

Instance Attribute Details

#dhparamObject

Returns the value of attribute dhparam.



36
37
38
# File 'lib/shared_infrastructure/nginx/nginx.rb', line 36

def dhparam
  @dhparam
end

#rootObject

Returns the value of attribute root.



36
37
38
# File 'lib/shared_infrastructure/nginx/nginx.rb', line 36

def root
  @root
end

Instance Method Details

#certbot_domain_names(domain_name) ⇒ Object



7
8
9
# File 'lib/shared_infrastructure/nginx/nginx.rb', line 7

def certbot_domain_names(domain_name)
  "#{domain_name} www.#{domain_name}"
end

#certificate_directory(domain_name) ⇒ Object



11
12
13
# File 'lib/shared_infrastructure/nginx/nginx.rb', line 11

def certificate_directory(domain_name)
  "#{root}/etc/letsencrypt/live/#{domain_name}"
end

#enabled_server_block_location(domain_name) ⇒ Object



32
33
34
# File 'lib/shared_infrastructure/nginx/nginx.rb', line 32

def enabled_server_block_location(domain_name)
  "#{root}/etc/nginx/sites-enabled/#{domain_name}"
end

#root?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/shared_infrastructure/nginx/nginx.rb', line 20

def root?
  !(root.nil? || root.empty?)
end

#root_directory(domain_name) ⇒ Object



24
25
26
# File 'lib/shared_infrastructure/nginx/nginx.rb', line 24

def root_directory(domain_name)
  "#{root}/var/www/#{domain_name}/html"
end

#server_block_location(domain_name) ⇒ Object



28
29
30
# File 'lib/shared_infrastructure/nginx/nginx.rb', line 28

def server_block_location(domain_name)
  "#{root}/etc/nginx/sites-available/#{domain_name}"
end