From 7ef47038a8628c614fd6fbda13c3dbddff689bff Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Wed, 25 May 2016 06:35:54 -0400 Subject: [PATCH] mapping for sandboxed sites --- Rakefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 693f9053..2d419647 100644 --- a/Rakefile +++ b/Rakefile @@ -86,6 +86,7 @@ end desc 'Compile nginx mapfiles' task :compile_nginx_mapfiles => [:environment] do FileUtils.mkdir_p './files/maps' + File.open('./files/maps/domains.txt', 'w') do |file| Site.exclude(domain: nil).exclude(domain: '').select(:username,:domain).all.each do |site| file.write ".#{site.values[:domain]} #{site.username};\n" @@ -104,9 +105,9 @@ task :compile_nginx_mapfiles => [:environment] do end end - # Legacy for existing system - FileUtils.cp './files/maps/domains.txt', './files/map.txt' - FileUtils.cp './files/maps/supporters.txt', './files/supporter-map.txt' + File.open('./files/maps/sandboxed.txt', 'w') do |file| + usernames = DB["select username from sites where created_at > ? and (plan_type is null or plan_type='free')", 1.week.ago].all.collect {|s| s[:username]}.each {|username| file.write "#{username}\n"} + end end desc 'Produce SSL config package for proxy'