fluentd-ui/app/models/fluentd/setting/out_td.rb
uu59 3c7786f262 Refactor plugin setting
Adding support for some plugins was hard.
After this commit, easy to add a plugin that has commonly
setting style.

Before:
- Add model, controller, and views for it.

After:
- Add model and controller. view is shared.
2014-11-04 14:29:31 +09:00

48 lines
958 B
Ruby

class Fluentd
module Setting
class OutTd
include ActiveModel::Model
include Common
KEYS = [
:match,
:apikey, :auto_create_table, :database, :table,
:flush_interval, :buffer_type, :buffer_path,
].freeze
attr_accessor(*KEYS)
flags :auto_create_table
validates :match, presence: true
validates :apikey, presence: true
validates :auto_create_table, presence: true
def plugin_name
"tdlog"
end
def self.initial_params
{
buffer_type: "file",
buffer_path: "/var/log/td-agent/buffer/td",
auto_create_table: true,
match: "td.*.*",
}
end
def common_options
[
:match, :apikey, :auto_create_table, :database, :table,
]
end
def advanced_options
[
:flush_interval, :buffer_type, :buffer_path,
]
end
end
end
end