require 'mailshears'
-pgadb = PostfixadminDb.new(Configuration::dbhost,
- Configuration::dbport,
- Configuration::dbopts,
- Configuration::dbtty,
- Configuration::dbname,
- Configuration::dbuser,
- Configuration::dbpass)
+cfg = Configuration.new()
+pgadb = PostfixadminDb.new(cfg.dbhost,
+ cfg.dbport,
+ cfg.dbopts,
+ cfg.dbtty,
+ cfg.dbname,
+ cfg.dbuser,
+ cfg.dbpass)
begin
puts "Found: #{account} (#{plugin.describe_account(account)})"
end
- if Configuration::i_mean_business
+ if cfg.i_mean_business
# We have to delete the accounts before the domain,
# otherwise they'd already be gone.
leftover_accounts.each do |account|
# Load the rest of the code we'll use.
# And the necessary classes.
-require 'mailshears/errors.rb'
-require 'mailshears/exit_codes.rb'
+require 'mailshears/configuration'
+require 'mailshears/errors'
+require 'mailshears/exit_codes'
require 'mailshears/postfixadmin_db'
-# Load the default config file first, and let the user override it.
-require 'default_configuration'
+cfg = Configuration.new()
-userconf_path = ENV['HOME'] + '/.mailshears.conf.rb'
-begin
- # Don't crash if it doesn't exist. Maybe he likes the defaults?
- require userconf_path
-rescue LoadError
-end
-
-Configuration::plugins.each do |plugin_file|
+Configuration.plugins.each do |plugin_file|
require "mailshears/plugins/#{plugin_file}"
end
-
# Needed for rm_rf.
require 'fileutils'
+require 'mailshears/configuration'
require 'mailshears/errors'
require 'mailshears/filesystem'
require 'mailshears/mailstore'
include Plugin
def initialize
- @domain_root = Configuration::mail_root
+ cfg = Configuration.new()
+ @domain_root = cfg.mail_root
end
def describe_domain(domain)
include Plugin
def initialize()
- @db_host = Configuration::roundcube_dbhost
- @db_port = Configuration::roundcube_dbport
- @db_opts = Configuration::roundcube_dbopts
- @db_tty = Configuration::roundcube_dbtty
- @db_name = Configuration::roundcube_dbname
- @db_user = Configuration::roundcube_dbuser
- @db_pass = Configuration::roundcube_dbpass
+ cfg = Configuration.new()
+ @db_host = cfg.roundcube_dbhost
+ @db_port = cfg.roundcube_dbport
+ @db_opts = cfg.roundcube_dbopts
+ @db_tty = cfg.roundcube_dbtty
+ @db_name = cfg.roundcube_dbname
+ @db_user = cfg.roundcube_dbuser
+ @db_pass = cfg.roundcube_dbpass
end