diff --git a/README.md b/README.md index 1dca523..8ae8fc7 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,7 @@ end * `path` – Base path for the application. *(name attribute)* * `port` – Port to listen on. *(default: 80)* +* `address` – Address to bind to. *(default: 0.0.0.0)* * `service_name` – Name of the service to create. *(default: auto-detect)* # `user` – User to run the service as. *(default: application owner)* diff --git a/lib/poise_application_ruby/resources/unicorn.rb b/lib/poise_application_ruby/resources/unicorn.rb index 1d22f7c..e36ba1c 100644 --- a/lib/poise_application_ruby/resources/unicorn.rb +++ b/lib/poise_application_ruby/resources/unicorn.rb @@ -51,6 +51,9 @@ class Resource < Chef::Resource # @!attribute port # Port to bind to. attribute(:port, kind_of: [String, Integer], default: 80) + # @!attribute address + # Address to bind to. + attribute(:address, kind_of: String, default: 0.0.0.0) end # Provider for `application_unicorn`. @@ -79,7 +82,7 @@ def configru_path # Set service resource options. def service_options(resource) super - resource.ruby_command("unicorn --port #{new_resource.port} #{configru_path}") + resource.ruby_command("unicorn --host #{new_resource.address} --port #{new_resource.port} #{configru_path}") end end end