added the type of config block i want to have. not ready but setup a skeleton to use with it
This commit is contained in:
parent
c3fe3a2bb7
commit
6c0b401d23
5 changed files with 27 additions and 19 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -8,6 +8,7 @@
|
|||
/tmp/
|
||||
/data
|
||||
Gemfile.lock
|
||||
.config
|
||||
|
||||
# rspec failure tracking
|
||||
.rspec_status
|
||||
|
|
13
bin/console
13
bin/console
|
@ -1,14 +1,19 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'sidekiq'
|
||||
require 'sidekiq/api'
|
||||
require 'pry'
|
||||
|
||||
|
||||
require '../lib/pastebinner'
|
||||
require '../lib/elastic_search_helper'
|
||||
require '../lib/paste_to_es'
|
||||
|
||||
# You can add fixtures and/or initialization code here to make experimenting
|
||||
# with your gem easier. You can also use a different console, if you like.
|
||||
|
||||
# (If you use this, don't forget to add pry to your Gemfile!)
|
||||
require 'pry'
|
||||
|
||||
# set restclient logging and setup a pb object
|
||||
RestClient.log ='stdout'
|
||||
pb = Pastebinner.new(ENV['pastebin_api_key'], ENV['pastebin_username'], ENV['pastebin_password'])
|
||||
es = ElasticSearchHelper.new(ENV['elastic_search_url'], 'pastes')
|
||||
|
||||
binding.pry
|
||||
|
|
8
config/configuration.rb
Normal file
8
config/configuration.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
# ideally i want to have a configuration block like this loaded
|
||||
Pastebinner.configure do |config|
|
||||
config.pastebin_username = pastebin_username
|
||||
config.pastebin_password = pastebin_password
|
||||
config.pastebin_api_key = pastebin_api_key
|
||||
config.elastic_search_url = elastic_search_url
|
||||
config.redis_url = redis_url
|
||||
end
|
9
config/initializers/sidekiq.rb
Normal file
9
config/initializers/sidekiq.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
# server config
|
||||
Sidekiq.configure_server do |config|
|
||||
config.redis = { url: ENV["REDIS_SERVER_URL"] }
|
||||
end
|
||||
|
||||
# client config
|
||||
Sidekiq.configure_client do |config|
|
||||
config.redis = { url: ENV["REDIS_SERVER_URL"] }
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
class Configuration
|
||||
# this is going to be where i store config options like
|
||||
# - database or directory. directory is built in, we just need to fine tune it a bit more
|
||||
# - we will start doing just a standard sqlite file for raw pastes as a test
|
||||
|
||||
# we can use systemd service/timer files to generate a way to automate downloading raw pastes.
|
||||
def generate_service_file(user=, working_directory=, exec_start=)
|
||||
# this should maybe be a HERE document that will create the file with the
|
||||
# or just open the base template file that we have and replace these specific lines.
|
||||
end
|
||||
|
||||
def build_cron
|
||||
# need to lookup what we have to put in PATH in the cron to inherit the environment variables for the api key,username,password
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue