[Groonga-commit] groonga/fluent-plugin-groonga at 04fe97e [master] in: validate in config_param

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Wed Oct 15 18:29:36 JST 2014


Kouhei Sutou	2014-10-15 18:29:36 +0900 (Wed, 15 Oct 2014)

  New Revision: 04fe97ebf7a6d3739c0ca695579f34823c70e4d3
  https://github.com/groonga/fluent-plugin-groonga/commit/04fe97ebf7a6d3739c0ca695579f34823c70e4d3

  Message:
    in: validate in config_param

  Modified files:
    lib/fluent/plugin/in_groonga.rb

  Modified: lib/fluent/plugin/in_groonga.rb (+10 -7)
===================================================================
--- lib/fluent/plugin/in_groonga.rb    2014-10-15 18:21:20 +0900 (361ab6d)
+++ lib/fluent/plugin/in_groonga.rb    2014-10-15 18:29:36 +0900 (b345e8c)
@@ -32,19 +32,22 @@ module Fluent
       super
     end
 
-    config_param :protocol, :string, :default => "http"
+    config_param :protocol, :defalut => :http do |value|
+      case value
+      when "http", "gqtp"
+        value.to_sym
+      else
+        raise ConfigError, "must be http or gqtp: <#{value}>"
+      end
+    end
 
     def configure(conf)
       super
       case @protocol
-      when "http"
+      when :http
         @input = HTTPInput.new
-      when "gqtp"
+      when :gqtp
         @input = GQTPInput.new
-      else
-        message = "unknown protocol: <#{@protocol.inspect}>"
-        $log.error message
-        raise ConfigError, message
       end
       @input.configure(conf)
     end
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る