lib/ms_deploy/recipes/nginx.rb in ms_deploy-0.1.4 vs lib/ms_deploy/recipes/nginx.rb in ms_deploy-0.1.5
- old
+ new
@@ -1,6 +1,6 @@
-require "ms_deploy/render"
+require "ms_deploy/render"
Capistrano::Configuration.instance.load do
namespace :service do
namespace :nginx do
@@ -29,20 +29,34 @@
end
task :install do
protocol = fetch(:protocol, nil).to_s
template_path = File.expand_path('../../templates/vhost.erb', __FILE__)
- vars = {'application'=> application, 'project_root' => deploy_to + '/current', 'domain' => vhost_domain, 'stage' => stage, 'auth_basic_title' => fetch(:auth_basic_title, nil), 'auth_basic_password_file' => fetch(:auth_basic_password_file, nil), 'protocol' => 'http', 'nginx_cert_dir' => fetch(:nginx_cert_dir, '/etc/nginx/cert'), 'with_upstream_server' => true, 'with_file_expire_max' => fetch(:with_file_expire_max, true), 'optional_http_content' => fetch(:optional_nginx_server_http_content, ''), 'optional_https_content' => fetch(:optional_nginx_server_https_content, '')}
+ vars = {
+ 'application'=> application,
+ 'project_root' => deploy_to + '/current',
+ 'domain' => vhost_domain, 'stage' => stage,
+ 'auth_basic_title' => fetch(:auth_basic_title, nil),
+ 'auth_basic_password_file' => fetch(:auth_basic_password_file, nil),
+ 'protocol' => 'http',
+ 'nginx_cert_dir' => fetch(:nginx_cert_dir, '/etc/nginx/cert'),
+ 'with_upstream_server' => true,
+ 'with_file_expire_max' => fetch(:with_file_expire_max, true),
+ 'optional_http_content' => fetch(:optional_nginx_server_http_content, ''),
+ 'optional_https_content' => fetch(:optional_nginx_server_https_content, ''),
+ 'cert_type' => fetch(:cert_type, 'pem'),
+ 'key_type' => fetch(:cert_type, 'key')
+ }
if protocol.nil? or protocol == 'http' or protocol == 'both'
config_path = "#{shared_path}/config/#{application}_vhost.conf"
put(render_erb_template(template_path, vars), config_path)
sudo "rm -f /etc/nginx/sites-enabled/#{application}_#{stage}.conf"
sudo "ln -s #{config_path} /etc/nginx/sites-enabled/#{application}_#{stage}.conf"
end
if protocol == 'https' or protocol == 'both'
- vars.merge!({'protocol' => 'https', 'with_upstream_server' => false})
+ vars.merge!({'protocol' => 'https'})
config_path = "#{shared_path}/config/#{application}_ssl_vhost.conf"
put(render_erb_template(template_path, vars), config_path)
sudo "rm -f /etc/nginx/sites-enabled/#{application}_#{stage}_ssl.conf"