Sha256: 76c5af9066d3f5879cd591fd559312097cfed3acb2e73a425b16d21a9c67d816

Contents?: true

Size: 802 Bytes

Versions: 1

Compression:

Stored size: 802 Bytes

Contents

class Fluentd::SettingsController < ApplicationController
  before_action :login_required
  before_action :find_fluentd
  before_action :set_config, only: [:show, :edit, :update]

  def show
  end

  def edit
  end

  def  update
    Fluent::Config::V1Parser.parse(params[:config], @fluentd.config_file)
    @fluentd.agent.config_write params[:config]
    @fluentd.agent.restart if @fluentd.agent.running?
    redirect_to daemon_setting_path(@fluentd)
  rescue Fluent::ConfigParseError => e
    @config = params[:config]
    @error = e.message
    render "edit"
  end

  def source_and_output
    # TODO: error handling if config file has invalid syntax
    # @config = Fluentd::Setting::Config.new(@fluentd.config_file)
  end

  private

  def set_config
    @config = @fluentd.agent.config
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluentd-ui-0.3.9 app/controllers/fluentd/settings_controller.rb