lib/capistrano/tasks/nginx.rake in capistrano3-nginx-2.1.2 vs lib/capistrano/tasks/nginx.rake in capistrano3-nginx-2.1.3
- old
+ new
@@ -1,15 +1,15 @@
namespace :load do
task :defaults do
set :nginx_sudo_paths, -> { [:nginx_log_path, :nginx_sites_enabled_dir, :nginx_sites_available_dir] }
set :nginx_sudo_tasks, -> { ['nginx:start', 'nginx:stop', 'nginx:restart', 'nginx:reload', 'nginx:configtest', 'nginx:site:add', 'nginx:site:disable', 'nginx:site:enable', 'nginx:site:remove' ] }
set :nginx_log_path, -> { "#{shared_path}/log" }
- set :nginx_root_path, -> { "/etc/nginx" }
set :nginx_service_path, -> { 'service nginx' }
set :nginx_static_dir, -> { "public" }
- set :nginx_sites_enabled_dir, -> { "sites-enabled" }
- set :nginx_sites_available_dir, -> { "sites-available" }
+ set :nginx_application_name, -> { fetch(:application) }
+ set :nginx_sites_enabled_dir, -> { "/etc/nginx/sites-enabled" }
+ set :nginx_sites_available_dir, -> { "/etc/nginx/sites-available" }
set :nginx_roles, -> { :web }
set :nginx_template, -> { :default }
set :nginx_use_ssl, -> { false }
set :nginx_ssl_certificate, -> { "#{fetch(:application)}.crt" }
set :nginx_ssl_certificate_path, -> { '/etc/ssl/certs' }
@@ -40,14 +40,14 @@
nginx_service = fetch(:nginx_service_path)
test "[ $(#{test_sudo}#{nginx_service} configtest | grep -c 'fail') -eq 0 ]"
end
task :load_vars do
- set :sites_available, -> { File.join(fetch(:nginx_root_path), fetch(:nginx_sites_available_dir)) }
- set :sites_enabled, -> { File.join(fetch(:nginx_root_path), fetch(:nginx_sites_enabled_dir)) }
- set :enabled_application, -> { File.join(fetch(:sites_enabled), fetch(:application)) }
- set :available_application, -> { File.join(fetch(:sites_available), fetch(:application)) }
+ set :sites_available, -> { fetch(:nginx_sites_available_dir) }
+ set :sites_enabled, -> { fetch(:nginx_sites_enabled_dir) }
+ set :enabled_application, -> { File.join(fetch(:sites_enabled), fetch(:nginx_application_name)) }
+ set :available_application, -> { File.join(fetch(:sites_available), fetch(:nginx_application_name)) }
end
# validate_sudo_settings
task :validate_user_settings do
path_and_dir_keys = [:nginx_log_path, :nginx_sites_enabled_dir, :nginx_sites_available_dir]
@@ -106,10 +106,10 @@
if config_file == :default
config_file = File.expand_path('../../../../templates/nginx.conf.erb', __FILE__)
end
config = ERB.new(File.read(config_file)).result(binding)
upload! StringIO.new(config), '/tmp/nginx.conf'
- arguments = :mv, '/tmp/nginx.conf', fetch(:application)
+ arguments = :mv, '/tmp/nginx.conf', fetch(:nginx_application_name)
add_sudo_if_required arguments, 'nginx:sites:add', :nginx_sites_available_dir
execute *arguments
end
end
end