pastebinner/bin/console

32 lines
914 B
Ruby
Executable file

#!/usr/bin/env ruby
require 'sidekiq'
require 'sidekiq/api'
require 'bundler/setup'
require 'pastebinner'
require 'pry'
# setup restclient log to the console
# make it into a method to toggle on or off
def rest_client_toggle_log(default=false)
if default
RestClient.log = 'stdout'
end
end
Pastebinner.configure do |config|
config.api_key = ENV['pastebin_api_key']
config.api_username = ENV['pastebin_username']
config.api_password = ENV['pastebin_password']
config.elasticsearch_url = ENV['elasticsearch_url']
config.redis_url = ENV['redis_url']
end
pb = Pastebinner::ApiClient.new(Pastebinner.configuration.api_key, Pastebinner.configuration.api_username, Pastebinner.configuration.api_password)
es = Pastebinner::ElasticSearchHelper.new(Pastebinner.configuration.elasticsearch_url, 'pastes')
# sidekiq worker to send pastes to es
paste_to_es_job = Pastebinner::PasteToEs.new
binding.pry