Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up and configure ngp_van gem #134

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ SENTRY_DSN=
CORS_ORIGINS=
MIN_COMPATIBLE_APP_VERSION=
FORCE_SSL=
NGP_VAN_APPLICATION_NAME=
NGP_VAN_API_KEY=
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ gem 'newrelic_rpm'

gem 'rack-cors', require: 'rack/cors'

gem 'ngp_van', git: 'https://github.com/christopherstyles/ngp_van.git'

group :development, :production do
gem 'rails_12factor'
end
Expand Down
11 changes: 10 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ GIT
activemodel (>= 4.0)
railties (>= 4.0)

GIT
remote: https://github.com/christopherstyles/ngp_van.git
revision: c5b32106c1727cca35ebbf8807acd140d049ccb5
specs:
ngp_van (0.1.0)
faraday (~> 0.9.2)
faraday_middleware (~> 0.10.0)

GIT
remote: https://github.com/thoughtbot/paperclip
revision: 523bd46c768226893f23889079a7aa9c73b57d68
Expand Down Expand Up @@ -317,6 +325,7 @@ DEPENDENCIES
koala
leaderboard
newrelic_rpm
ngp_van!
oauth2
paperclip!
parse-ruby-client
Expand All @@ -340,4 +349,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
1.10.6
1.11.2
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ Rails API for crowdsourced voter canvassing.
### Setup

1. Clone the repository (`git clone [email protected]:Bernie-2016/fieldthebern-api.git`)
2. Install gem dependencies: `bundle install`
3. Create and migrate the database: `rake db:setup`
4. Copy `.env.sample` to `.env`. Create test apps with the relevant services to get credentials.
5. Run `gem install foreman` to install the foreman gem, used for running Procfile-based apps.
6. Run `foreman start` to start the server.
2. Obtain an oauth access token for `ngp_van` from a team member in Slack.
3. Configure the project locally: `bundle config --local GITHUB_OAUTH_TOKEN <token>:x-oauth-basic`
4. Install gem dependencies: `bundle install`
5. Create and migrate the database: `rake db:setup`
6. Copy `.env.sample` to `.env`. Create test apps with the relevant services to get credentials.
7. Run `gem install foreman` to install the foreman gem, used for running Procfile-based apps.
8. Run `foreman start` to start the server.

### Testing
`http://api.lvh.me:5000/ping`
Expand Down
13 changes: 13 additions & 0 deletions config/initializers/ngp_van.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ngp_van_enabled = %w(
NGP_VAN_APPLICATION_NAME
NGP_VAN_API_KEY
).all? { |key| ENV.key? key }

if ngp_van_enabled
require 'ngp_van'

NgpVan.configure do |config|
config.application_name = ENV['NGP_VAN_APPLICATION_NAME']
config.api_key = ENV['NGP_VAN_API_KEY']
end
end