Class: SharedInfrastructure::Domain

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain_names) ⇒ Domain

Returns a new instance of Domain.



25
26
27
28
# File 'lib/shared_infrastructure/domain.rb', line 25

def initialize(domain_names)
  domain_names = [domain_names] unless domain_names.respond_to?(:map)
  @domain_names = domain_names
end

Instance Attribute Details

#domain_namesObject (readonly)

Returns the value of attribute domain_names.



47
48
49
# File 'lib/shared_infrastructure/domain.rb', line 47

def domain_names
  @domain_names
end

Instance Method Details

#available_siteObject



5
6
7
# File 'lib/shared_infrastructure/domain.rb', line 5

def available_site
  "/etc/nginx/sites-available/#{domain_name}"
end

#certbot_domain_namesObject



9
10
11
# File 'lib/shared_infrastructure/domain.rb', line 9

def certbot_domain_names
  domain_names.map { |domain| "#{domain} www.#{domain}" }.join(" ")
end

#certificate_directoryObject



13
14
15
# File 'lib/shared_infrastructure/domain.rb', line 13

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

#domain_nameObject



17
18
19
# File 'lib/shared_infrastructure/domain.rb', line 17

def domain_name
  domain_names.first
end

#enabled_siteObject



21
22
23
# File 'lib/shared_infrastructure/domain.rb', line 21

def enabled_site
  "/etc/nginx/sites-enabled/#{domain_name}"
end

#rails_env_log(rails_env = "production") ⇒ Object



30
31
32
# File 'lib/shared_infrastructure/domain.rb', line 30

def rails_env_log(rails_env = "production")
  "/var/www/#{domain_name}/log/#{rails_env}.log"
end

#rootObject



34
35
36
# File 'lib/shared_infrastructure/domain.rb', line 34

def root
  "/var/www/#{domain_name}"
end

#secretsObject

TODO: Remove this if not needed.



39
40
41
# File 'lib/shared_infrastructure/domain.rb', line 39

def secrets
  File.join(site_root, "secrets")
end

#site_rootObject



43
44
45
# File 'lib/shared_infrastructure/domain.rb', line 43

def site_root
  File.join(root, "html")
end