lib/fluent/plugin/bigquery/writer.rb in fluent-plugin-bigquery-0.3.1 vs lib/fluent/plugin/bigquery/writer.rb in fluent-plugin-bigquery-0.3.2

- old
+ new

@@ -285,15 +285,17 @@ def get_auth_from_json_key json_key = @auth_options[:json_key] begin + JSON.parse(json_key) + key = StringIO.new(json_key) + Google::Auth::ServiceAccountCredentials.make_creds(json_key_io: key, scope: @scope) + rescue JSON::ParserError + key = json_key File.open(json_key) do |f| Google::Auth::ServiceAccountCredentials.make_creds(json_key_io: f, scope: @scope) end - rescue Errno::ENOENT - key = StringIO.new(json_key) - Google::Auth::ServiceAccountCredentials.make_creds(json_key_io: key, scope: @scope) end end def get_auth_from_application_default Google::Auth.get_application_default([@scope])