Merge pull request #5473 from betagouv/externalize_deploy_target

Remove host references from public sources
This commit is contained in:
LeSim 2020-08-12 17:20:05 +02:00 committed by GitHub
commit e4615490fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,16 +1,13 @@
def domains_for_stage(stage)
case stage
when 'dev'
['web1.dev', 'web2.dev']
when 'prod'
['web1', 'web2', 'web3', 'web4']
def domains_for_stage
if ENV['DOMAINS'].present?
ENV['DOMAINS'].split
else
raise "STAGE #{stage} is unknown. It must be either dev or prod."
raise "DOMAINS is empty. It must be something like DOMAINS='web1.dev web2.dev'"
end
end
task :setup do
domains = domains_for_stage(ENV.fetch('STAGE'))
domains = domains_for_stage
domains.each do |domain|
sh "mina setup domain=#{domain}"
@ -18,7 +15,7 @@ task :setup do
end
task :deploy do
domains = domains_for_stage(ENV.fetch('STAGE'))
domains = domains_for_stage
branch = ENV.fetch('BRANCH')
domains.each do |domain|
@ -27,14 +24,14 @@ task :deploy do
end
task :post_deploy do
domains = domains_for_stage(ENV.fetch('STAGE'))
domains = domains_for_stage
branch = ENV.fetch('BRANCH')
sh "mina post_deploy domain=#{domains.first} branch=#{branch}"
end
task :rollback do
domains = domains_for_stage(ENV.fetch('STAGE'))
domains = domains_for_stage
branch = ENV.fetch('BRANCH')
domains.each do |domain|