Commit 181921eb544b176fdbcd2f73d32e90413289eafc:
production location for the database
Branch: refs/heads/master
Author: Sam Ruby <[email protected]>
Committer: Sam Ruby <[email protected]>
Pusher: rubys <[email protected]>
------------------------------------------------------------
www/secmail/config.rb | + -
www/secmail/parsemail.rb | ++ ----
------------------------------------------------------------
8 changes: 3 additions, 5 deletions.
------------------------------------------------------------
diff --git a/www/secmail/config.rb b/www/secmail/config.rb
index 39d6199..2e83339 100644
--- a/www/secmail/config.rb
+++ b/www/secmail/config.rb
@@ -8,5 +8,5 @@
# Where to save the archive locally
#
-ARCHIVE = File.basename(SOURCE)
+ARCHIVE = (Dir.exist?('/srv/mail') ? '/srv/mail' : File.basename(SOURCE))
diff --git a/www/secmail/parsemail.rb b/www/secmail/parsemail.rb
index a426593..a501f37 100644
--- a/www/secmail/parsemail.rb
+++ b/www/secmail/parsemail.rb
@@ -12,8 +12,6 @@
require_relative 'models/mailbox'
-database = File.basename(SOURCE)
-
Dir.chdir File.dirname(File.expand_path(__FILE__))
if ARGV.include? '--fetch1'
@@ -26,13 +24,13 @@
Mailbox.fetch months
elsif ARGV.include? '--fetch1'
Mailbox.fetch Time.now.strftime('%Y%m')
-elsif ARGV.include? '--fetch' or not Dir.exist? database
+elsif ARGV.include? '--fetch' or not Dir.exist? ARCHIVE
Mailbox.fetch
end
# scan each mailbox for updates
width = 0
-Dir[File.join(database, '2*')].sort.each do |name|
+Dir[File.join(ARCHIVE, '2*')].sort.each do |name|
# skip YAML files, update output showing latest file being processed
next if name.end_with? '.yml' or name.end_with? '.mail'
next if ARGV.any? {|arg| arg =~ /^\d{6}$/} and