mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
add additional env when start rails, such as : secret key, db username, db pwd or other what you want
This commit is contained in:
parent
75fa5fd2fd
commit
b2f604cc64
1 changed files with 8 additions and 3 deletions
|
@ -22,7 +22,7 @@ Capistrano::Configuration.instance.load do
|
|||
namespace :puma do
|
||||
desc 'Start puma'
|
||||
task :start, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
|
||||
run "cd #{current_path} && #{puma_cmd} #{start_options}", :pty => false
|
||||
run "cd #{current_path} && #{deploy_additional_env} #{puma_cmd} #{start_options}", :pty => false
|
||||
end
|
||||
|
||||
desc 'Stop puma'
|
||||
|
@ -33,7 +33,7 @@ Capistrano::Configuration.instance.load do
|
|||
desc 'Restart puma'
|
||||
task :restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
|
||||
begin
|
||||
run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} restart"
|
||||
run "cd #{current_path} && #{deploy_additional_env} #{pumactl_cmd} -S #{state_path} restart"
|
||||
rescue Capistrano::CommandError => ex
|
||||
puts "Failed to restart puma: #{ex}\nAssuming not started."
|
||||
start
|
||||
|
@ -43,7 +43,7 @@ Capistrano::Configuration.instance.load do
|
|||
desc 'Restart puma (phased restart)'
|
||||
task :phased_restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
|
||||
begin
|
||||
run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} phased-restart"
|
||||
run "cd #{current_path} && #{deploy_additional_env} #{pumactl_cmd} -S #{state_path} phased-restart"
|
||||
rescue Capistrano::CommandError => ex
|
||||
puts "Failed to restart puma: #{ex}\nAssuming not started."
|
||||
start
|
||||
|
@ -72,6 +72,11 @@ Capistrano::Configuration.instance.load do
|
|||
fetch(:rack_env, fetch(:rails_env, 'production'))
|
||||
end
|
||||
|
||||
#add additional env when start rails, such as : secret key, db username, db pwd or other what you want.
|
||||
def deploy_additional_env
|
||||
fetch(:deploy_additional_env, '')
|
||||
end
|
||||
|
||||
def state_path
|
||||
(config_file ? configuration.options[:state] : nil) || puma_state
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue