]>
gitweb.michael.orlitzky.com - mailshears.git/blob - common/configuration.rb
5 USERCONF_PATH
= ENV['HOME'] +
'/.mailshears.conf.yml'
8 def initialize(path
= USERCONF_PATH
)
9 cfg
= default_configuration()
11 # Now, load the user configuration which will override the
12 # variables defined above.
14 user_config
= YAML
.load(File
.open(path
))
16 # Write our own update() method for Ruby 1.8.
17 user_config
.each
do |key
, value
|
21 # If the user config file doesn't exist, whatever.
24 # Convert all of the keys to symbols.
25 cfg
= cfg
.inject({}){|memo
,(k
,v
)| memo
[k
.to_sym
] = v
; memo
}
31 def method_missing(sym
, *args
)
32 # Replace all missing method calls with dictionary lookups.
39 def default_configuration()
42 d
['i_mean_business'] = false
44 d
['postfixadmin_dbhost'] = 'localhost'
45 d
['postfixadmin_dbport'] = 5432
46 d
['postfixadmin_dbopts'] = ''
47 d
['postfixadmin_dbtty'] = ''
48 d
['postfixadmin_dbuser'] = 'postgres'
49 d
['postfixadmin_dbpass'] = ''
50 d
['postfixadmin_dbname'] = 'postfixadmin'
52 d
['plugins'] = ['postfixadmin',
58 d
['mail_root'] = '/var/spool/mail/vhosts'
60 d
['roundcube_dbhost'] = 'localhost'
61 d
['roundcube_dbport'] = 5432
62 d
['roundcube_dbopts'] = ''
63 d
['roundcube_dbtty'] = ''
64 d
['roundcube_dbuser'] = 'postgres'
65 d
['roundcube_dbpass'] = ''
66 d
['roundcube_dbname'] = 'roundcube'
68 d
['agendav_dbhost'] = 'localhost'
69 d
['agendav_dbport'] = 5432
70 d
['agendav_dbopts'] = ''
71 d
['agendav_dbtty'] = ''
72 d
['agendav_dbuser'] = 'postgres'
73 d
['agendav_dbpass'] = ''
74 d
['agendav_dbname'] = 'agendav'
76 d
['davical_dbhost'] = 'localhost'
77 d
['davical_dbport'] = 5432
78 d
['davical_dbopts'] = ''
79 d
['davical_dbtty'] = ''
80 d
['davical_dbuser'] = 'postgres'
81 d
['davical_dbpass'] = ''
82 d
['davical_dbname'] = 'davical'