Sha256: c2392483b799393335b4828cd250404b99fa64bd532a12ee669038d5fe637692
Contents?: true
Size: 1.33 KB
Versions: 9
Compression:
Stored size: 1.33 KB
Contents
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'rubygems' unless defined?(gem) ROOT = File.expand_path('..', File.dirname(__FILE__)) $LOAD_PATH << File.expand_path(File.join(ROOT, 'lib')) require 'dotenv' Dotenv.load # tweak default_options require 'fluent/supervisor' class Fluent::Supervisor class << self alias :fluentd_default_options :default_options end def self.default_options fluentd_default_options.merge({ :config_path => 'daioikachan.conf', :plugin_dirs => [File.join(ROOT, 'lib/fluent/plugin')], }) end end # handle argv to generate conf require 'optparse' opts = {} opt = OptionParser.new opt.on('-g', "--generate PATH", "generate a sample configuration file") {|s| opts[:generate_path] = s } begin opt.parse!(ARGV) rescue OptionParser::InvalidOption => e argv = ARGV # suppress warning to constant argv.unshift(*(e.args)) # restore and ignore unknown options to pass to Fluentd end if generate_path = opts[:generate_path] require 'fileutils' FileUtils.mkdir_p File.dirname(generate_path) if File.exist?(generate_path) puts "#{generate_path} already exists." else File.open(generate_path, "w") {|f| conf = File.read File.join(ROOT, 'examples/example.conf') f.write conf } puts "Installed #{generate_path}." end exit 0 end require 'fluent/command/fluentd'
Version data entries
9 entries across 9 versions & 1 rubygems