Skip to content

Commit

Permalink
Config linking: Damn, you so stupid.
Browse files Browse the repository at this point in the history
  • Loading branch information
psy-q committed Mar 27, 2014
1 parent a743f95 commit d120ba0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions config/deploy/demo-new.rb
Expand Up @@ -21,6 +21,7 @@
default_run_options[:shell] = false

set :deploy_to, "/home/leihs/#{application}"
set :secret_token, "/home/leihs/#{application}/secret_token.rb"

role :app, "leihs@rails.zhdk.ch"
role :web, "leihs@rails.zhdk.ch"
Expand Down
2 changes: 1 addition & 1 deletion config/deploy/production.rb
Expand Up @@ -13,8 +13,8 @@
set :deploy_via, :remote_cache

set :db_config, "/home/leihs/#{application}/database.yml"
#set :app_config, "/home/leihs/#{application}/application.rb"
set :ldap_config, "/home/leihs/#{application}/LDAP.yml"
set :secret_token, "/home/leihs/#{application}/secret_token.rb"
set :use_sudo, false

set :rails_env, "production"
Expand Down
12 changes: 6 additions & 6 deletions config/deploy/recipes/link_config.rb
@@ -1,14 +1,14 @@
task :link_config do
if File.exist?("#{release_path}/config/LDAP.yml")
run "rm #{release_path}/config/LDAP.yml"
run "ln -s #{ldap_config} #{release_path}/config/LDAP.yml"
if exists?(:ldap_config)
run "if [[ -f #{ldap_config} ]]; then ln -sf #{ldap_config} #{release_path}/config/LDAP.yml; fi"
end

run "rm -f #{release_path}/config/database.yml"
# run "rm -f #{release_path}/config/application.rb"
if exists?(:secret_token)
run "if [[ -f #{ldap_config} ]]; then ln -sf #{secret_token} #{release_path}/config/initializers/secret_token.rb; fi"
end

run "rm -f #{release_path}/config/database.yml"
run "ln -s #{db_config} #{release_path}/config/database.yml"
# run "ln -s #{app_config} #{release_path}/config/application.rb"

# So we can check from outside which revision is deployed on that instance
# Note: Must use a .txt suffix so that Passengers knows to deliver this
Expand Down
3 changes: 2 additions & 1 deletion config/deploy/staging.rb
Expand Up @@ -15,8 +15,9 @@
set :deploy_via, :remote_cache

set :db_config, "/home/leihs/#{application}/database.yml"
#set :app_config, "/home/leihs/#{application}/application.rb"
set :ldap_config, "/home/leihs/#{application}/LDAP.yml"
set :secret_token, "/home/leihs/#{application}/secret_token.rb"

set :use_sudo, false

set :rails_env, "production"
Expand Down

0 comments on commit d120ba0

Please sign in to comment.