Class: Nginx::Builder::Site
- Defined in:
- lib/shared_infrastructure/nginx/builder.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(user, *server_blocks, domain: nil) ⇒ Site
constructor
A new instance of Site.
- #save ⇒ Object
- #user ⇒ Object
Methods inherited from Base
#https_reminder_message, #to_s
Constructor Details
#initialize(user, *server_blocks, domain: nil) ⇒ Site
Returns a new instance of Site.
103 104 105 106 |
# File 'lib/shared_infrastructure/nginx/builder.rb', line 103 def initialize(user, *server_blocks, domain: nil) super(*server_blocks, domain: domain) @user = user end |
Instance Method Details
#save ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/shared_infrastructure/nginx/builder.rb', line 108 def save domain_root = SharedInfrastructure::Output.file_name(domain.root) FileUtils.mkdir_p(domain_root) if Process.uid.zero? FileUtils.chown(user, "www-data", domain_root) end # Set the directory gid bit, so files created inside inherit the group. File.chmod(File.stat(domain_root).mode | 0o2000, domain_root) super end |
#user ⇒ Object
121 122 123 |
# File 'lib/shared_infrastructure/nginx/builder.rb', line 121 def user @user ||= Etc.getlogin end |