lib/perkins/application.rb in perkins-0.0.2 vs lib/perkins/application.rb in perkins-0.0.3
- old
+ new
@@ -7,16 +7,17 @@
class << self
attr_accessor :instance
end
def initialize(opts={})
- host = opts[:host] unless opts[:host].blank?
- post = opts[:port] unless opts[:port].blank?
- github_client_id = opts[:github_client_id] unless opts[:github_client_id].blank?
- github_client_server = opts[:github_client_secret] unless opts[:github_client_secret].blank?
+ @host = opts[:host] unless opts[:host].blank?
+ @post = opts[:port] unless opts[:port].blank?
+ @github_client_id = opts[:github_client_id] unless opts[:github_client_id].blank?
+ @github_client_server = opts[:github_client_secret] unless opts[:github_client_secret].blank?
working_dir = opts[:working_dir] unless opts[:working_dir].blank?
self.class.instance = self
+ self.init_github_client
self
end
def database=(file)
@dbconfig = YAML::load(File.open(file))
@@ -24,9 +25,22 @@
setup_sidekiq
end
def database
@db
+ end
+
+ def init_github_client
+ #$github_client = Octokit::Client.new \
+ # :client_id => @github_client_id,
+ # :client_secret => @github_client_server
+
+ #GLOBAL SERVER 2 SERVER GITHUB CLIENT
+ $github_client ||= Octokit::Client.new(
+ login: ENV['LOGIN'],
+ access_token: ENV['ACCESS_TOKEN']
+ )
+
end
def redis=(opts={})
namespace = opts.delete(:namespace) || :perkins
redis_connection = Redis.new(opts)
\ No newline at end of file