To install, follow these steps:
- Put the following into your Gemfile:
group :development, :test do
gem 'dotenv-rails'
end
- Put this at the end of the Gemfile:
gem 'dixie_utils', git: 'git://github.com/mkwiatkowski/dixie_utils.git'
This line needs to be lower than the gem "dotenv" line.
-
Remove
config/initializers/session_store.rbfile. The gem takes care of configuring the session store. -
Create
.envfile at the root of the project with the following contents:
SECRET_KEY_BASE=ecb175b36a26139a9a4c1b056100ee77f8757aa465a57c42bfa828e785faaac67984b4c062b9b1a3b4c5286228d4d63cc574e76d023d54f01b19f0cd73e7096e
AUTH_URL=http://auth.localhost.com:3000/
DOMAIN=localhost.com
- Change development config in
config/secrets.ymlinto:
development:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
- Put the following line inside your
ApplicationControllerclass:
include DixieUtils::Authentication
-
Add
<%= logout_button %>somewhere in the views. -
Start your app with
rails s -p 3001and see your app in browser throughhttp://app.localhost.com:3001. You will need to setup your/etc/hostswith those domains to make it work. If dixie-auth app is running on 3000 you will be able to login and then get redirected back to your app. -
Before deployment to production make sure
SECRET_KEY_BASEandDOMAINenvironment variables are defined on Heroku and have the same values as the dixie-auth app.AUTH_URLenv variable needs to point to the production address of the dixie-auth app.
Whenever there is a new version, run the following command in your project directory:
bundle update dixie_utils