capistrano3 - How to set the server variable on the fly using capistrano 3 -


we're trying make our deployment scripts generic possible. possible have capistrano 3 prompt server address rather setting in config files.

so far have capistrao task does

namespace :config   task :setup     ask(:db_user, 'db_user')     ask(:db_pass, 'db_pass')     ask(:db_name, 'db_name')     ask(:db_host, 'db_host')     ask(:application, 'application')     ask(:web_server, 'server')     setup_config = <<-eof #{fetch(:rails_env)}:   adapter: postgresql   database: #{fetch(:db_name)}   username: #{fetch(:db_user)}   password: #{fetch(:db_pass)}   host: #{fetch(:db_host)}     eof     on roles(:app)       execute "mkdir -p #{shared_path}/config"       upload! stringio.new(setup_config), "#          {shared_path}/config/database.yml"         end       end     end 

and in production.rb file have

set :application, "#{fetch(:application)}" set :server_name, "#{fetch(:application)}.#{fetch(:server)}" set :app_port, "80" 

but when cap production config:setup run config script error asking me password. if hard code server address in production.rb file works fine...how can resolve this?

thanks

i hope else offers more elegant solution, if not:

i've done in cases environment variables. if want, can use makefile simplify of env combinations.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -