destiny-aviato / destinder-api

Back-end API for Destinder LFG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

destinder-api

Complete rewrite of the back-end API for Destinder LFG. Replaces the Destinder v1 API.

GitHub license Build Status Maintainability Test Coverage

Installation Instructions

Prerequisites

This app uses Ruby on Rails, so make sure you have both the Ruby programming language installed as well as the Rails gem.

Setup

To run the app, you'll need to install its dependencies (rails, postgres) first, then boot it up.

  1. Install gems bundle install
  2. Setup figaro for env varialbles: bundle exec figaro install
  3. Create the database: rake db:create
  4. Migrate the database: rake db:migrate
  5. Head to Bungie's Application Portal and create a new application with (Select OAuth client type of Confidential, use the REDIRECT_URL shown below, add * as the origin header, and select all permissions). This will generate a client ID, API key, and a client secret. Copy the all down and the following data to application.yml:
JWT_SECRET: <random_secret:string>
CLIENT_ID: <client_id:string>
CLIENT_SECRET: <client_secret:string>
X_API_KEY: <api_key_from_bungie:string>
REDIRECT_URL: "https://brianbolnick-dev-redirect.herokuapp.com/auth/bungie"
API_TOKEN: <api_key_from_bungie:string>
DESTINDER_CLIENT_URL: "http://localhost:3000/"
BUNGIE_ACCESS_TOKEN_URL: "https://www.bungie.net/Platform/App/OAuth/Token/"

It should look something like this when complete:

JWT_SECRET: "khas98yw3ouasod8wpi3hdpas9uoasihfo9q3dq"
CLIENT_ID: "12345"
CLIENT_SECRET: "csi83honc9s12jp9daS_@oa82o81!~9dsufjqp9"
X_API_KEY: "912087pdmo92u8qu0ac9u2"
REDIRECT_URL: "https://brianbolnick-dev-redirect.herokuapp.com/auth/bungie"
API_TOKEN: "912087pdmo92u8qu0ac9u2"
DESTINDER_CLIENT_URL: "http://localhost:3000/"
BUNGIE_ACCESS_TOKEN_URL: "https://www.bungie.net/Platform/App/OAuth/Token/"
  1. Start the server: rails s -p 5000
  2. Start jobs: bundle exec rake jobs:work

NOTE: If you receive the following error at any point:

Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

You need to restart the postgres server, or remove the postgres pid file like so:

rm /usr/local/var/postgres/postmaster.pid

Updating

To update your repo with the latest changes for the client or other dependencies, you can use the premade script:

  1. Run ./bin/update to fetch the latest changes for the API and the client, updating any dependencies along the way.

Contributing

We love and welcome all contribution requests! If you've either found a bug or have a feature you want added in, please create a pull request with a detailed comment outlining your changes (Follow this guide). Please also attach any screenshots of UI changes you may have made in the process as well. If you have any questions please file an issue on GitHub or send send us an email. We plan on reviewing all pull requests within 2 weeks of submission. Thanks!

About

Back-end API for Destinder LFG

License:MIT License


Languages

Language:Ruby 99.8%Language:HTML 0.2%