lib/embulk/output/groonga.rb in embulk-output-groonga-0.1.1 vs lib/embulk/output/groonga.rb in embulk-output-groonga-0.1.2
- old
+ new
@@ -11,10 +11,12 @@
# configuration code:
task = {
"host" => config.param("host", :string),
"port" => config.param("port", :integer, default: 10041),
"protocol" => config.param("protocol", :string, default: 'http'),
+ "user" => config.param("user", :string, default: nil),
+ "password" => config.param("password", :string, default: nil),
"key_column" => config.param("key_column",:string),
"table" => config.param("table",:string),
# "create_table" => config.param("create_table",:string)
}
prot = task['protocol']
@@ -36,15 +38,20 @@
# return next_config_diff
#end
def init
# initialization code:
- host = task["host"]
- port = task["port"]
- protocol = task["protocol"].to_sym
- @client = Groonga::Client.open({:host => host,
- :port => port,
- :protocol => protocol})
+ param = {}
+ param[:host] = task["host"]
+ param[:port] = task["port"]
+ param[:protocol] = task["protocol"].to_sym
+ if user = task["user"]
+ param[:user] = user
+ end
+ if password = task["password"]
+ param[:password] = password
+ end
+ @client = Groonga::Client.open(param)
@key_column = task["key_column"]
@out_table = task["table"]
# create_table
end