mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 15:43:44 +08:00
bb54eb1192
* store time it took to index message in DB (to find performance issues) * ignore listserv specific files * better examples for split_regex * first email in mbox shouldn't contain the split string * always lock the DB in exclusive mode * save email within transaction * messages can be grouped by subject and use original order (for Listserv) * adds option to index emails without running the import
31 lines
875 B
Ruby
31 lines
875 B
Ruby
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
|
|
attr_reader :prefer_html
|
|
attr_reader :staged
|
|
attr_reader :index_only
|
|
attr_reader :group_messages_by_subject
|
|
|
|
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']
|
|
@prefer_html = yaml['prefer_html']
|
|
@staged = yaml['staged']
|
|
@index_only = yaml['index_only']
|
|
@group_messages_by_subject = yaml['group_messages_by_subject']
|
|
end
|
|
end
|
|
end
|