-
Notifications
You must be signed in to change notification settings - Fork 1
/
environment.rb
38 lines (29 loc) · 1008 Bytes
/
environment.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'dotenv'
Dotenv.load
require 'cuba'
require 'cuba/render'
require 'json'
require 'tilt/haml'
require 'dalli'
require 'faraday-http-cache'
require 'octokit'
require_relative 'gittenizer'
class Dalli::Client
alias_method :write, :set
alias_method :read, :get
end
DALLI_OPTIONS = { username: ENV['MEMCACHIER_USERNAME'],
password: ENV['MEMCACHIER_PASSWORD'],
compress: true,
expires_in: 3600 }
DALLI_CACHE = Dalli::Client.new((ENV['MEMCACHIER_SERVERS'] || '').split(','), DALLI_OPTIONS)
OCTOKIT_STACK = Faraday::RackBuilder.new do |builder|
# builder.response :logger
builder.use Faraday::HttpCache, store: DALLI_CACHE, serializer: Marshal
builder.use Octokit::Response::RaiseError
builder.adapter Faraday.default_adapter
end
Octokit.middleware = OCTOKIT_STACK
# Octokit.auto_paginate = true
GITHUB = Octokit::Client.new client_id: ENV['GITHUB_CLIENT_ID'],
client_secret: ENV['GITHUB_CLIENT_SECRET']