2017-05-27 04:26:18 +08:00
|
|
|
require 'yaml'
|
|
|
|
|
|
|
|
module ImportScripts::Mbox
|
|
|
|
class Settings
|
|
|
|
def self.load(filename)
|
|
|
|
yaml = YAML.load_file(filename)
|
|
|
|
Settings.new(yaml)
|
|
|
|
end
|
|
|
|
|
|
|
|
attr_reader :data_dir
|
|
|
|
attr_reader :split_regex
|
|
|
|
attr_reader :batch_size
|
|
|
|
attr_reader :trust_level
|
2017-11-18 20:53:21 +08:00
|
|
|
attr_reader :prefer_html
|
2018-01-04 16:17:35 +08:00
|
|
|
attr_reader :staged
|
2018-01-17 19:03:57 +08:00
|
|
|
attr_reader :index_only
|
|
|
|
attr_reader :group_messages_by_subject
|
2017-05-27 04:26:18 +08:00
|
|
|
|
|
|
|
def initialize(yaml)
|
|
|
|
@data_dir = yaml['data_dir']
|
|
|
|
@split_regex = Regexp.new(yaml['split_regex']) unless yaml['split_regex'].empty?
|
|
|
|
@batch_size = 1000 # no need to make this actually configurable at the moment
|
|
|
|
@trust_level = yaml['default_trust_level']
|
2017-11-18 20:53:21 +08:00
|
|
|
@prefer_html = yaml['prefer_html']
|
2018-01-04 16:17:35 +08:00
|
|
|
@staged = yaml['staged']
|
2018-01-17 19:03:57 +08:00
|
|
|
@index_only = yaml['index_only']
|
|
|
|
@group_messages_by_subject = yaml['group_messages_by_subject']
|
2017-05-27 04:26:18 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|