Sha256: 306d3c49632602ced07307549c505f07924990c932947969b852fdae2121ea1b

Contents?: true

Size: 803 Bytes

Versions: 3

Compression:

Stored size: 803 Bytes

Contents

class Fluentd::Settings::InSyslogController < ApplicationController
  before_action :login_required
  before_action :find_fluentd

  def show
    @setting = Fluentd::Setting::InSyslog.new({
      bind: "0.0.0.0",
      port: 5140,
    })
  end

  def finish
    @setting = Fluentd::Setting::InSyslog.new(setting_params)
    unless @setting.valid?
      return render "show"
    end

    @fluentd.agent.config_append @setting.to_config
    if @fluentd.agent.running?
      unless @fluentd.agent.restart
        @setting.errors.add(:base, @fluentd.agent.log_tail(1).first)
        return render "show"
      end
    end
    redirect_to daemon_setting_path(@fluentd)
  end

  private

  def setting_params
    params.require(:fluentd_setting_in_syslog).permit(*Fluentd::Setting::InSyslog::KEYS)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fluentd-ui-0.1.2 app/controllers/fluentd/settings/in_syslog_controller.rb
fluentd-ui-0.1.1 app/controllers/fluentd/settings/in_syslog_controller.rb
fluentd-ui-0.1.0 app/controllers/fluentd/settings/in_syslog_controller.rb