Class: SharedInfrastructure::Domain
- Inherits:
-
Object
- Object
- SharedInfrastructure::Domain
- Defined in:
- lib/shared_infrastructure/domain.rb
Instance Attribute Summary collapse
-
#domain_names ⇒ Object
readonly
Returns the value of attribute domain_names.
Instance Method Summary collapse
- #available_site ⇒ Object
- #certbot_domain_names ⇒ Object
- #certificate_directory ⇒ Object
- #domain_name ⇒ Object
- #enabled_site ⇒ Object
-
#initialize(domain_names) ⇒ Domain
constructor
A new instance of Domain.
- #rails_env_log(rails_env = "production") ⇒ Object
- #root ⇒ Object
-
#secrets ⇒ Object
TODO: Remove this if not needed.
- #site_root ⇒ Object
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_names ⇒ Object (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_site ⇒ Object
5 6 7 |
# File 'lib/shared_infrastructure/domain.rb', line 5 def available_site "/etc/nginx/sites-available/#{domain_name}" end |
#certbot_domain_names ⇒ Object
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_directory ⇒ Object
13 14 15 |
# File 'lib/shared_infrastructure/domain.rb', line 13 def certificate_directory "/etc/letsencrypt/live/#{domain_name}" end |
#domain_name ⇒ Object
17 18 19 |
# File 'lib/shared_infrastructure/domain.rb', line 17 def domain_name domain_names.first end |
#enabled_site ⇒ Object
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 |
#root ⇒ Object
34 35 36 |
# File 'lib/shared_infrastructure/domain.rb', line 34 def root "/var/www/#{domain_name}" end |
#secrets ⇒ Object
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_root ⇒ Object
43 44 45 |
# File 'lib/shared_infrastructure/domain.rb', line 43 def site_root File.join(root, "html") end |