Skip to content

Commit

Permalink
Adjust for changes in Roda's sessions plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed Jul 12, 2018
1 parent e39d80c commit 6393bd3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ rake task to do that (be sure to read it first to see what it does):
You need to set the following enviroment variables:

LILA_SHELL\_DATABASE\_URL :: PostgreSQL database connection URL
LILA_SHELL_SESSION_CIPHER_SECRET :: session cipher secret, 32 bytes
LILA_SHELL_SESSION_HMAC_SECRET :: session HMAC secret, >=32 bytes
LILA_SHELL_SESSION_ECRET :: session secret, >=64 bytes

One way to set this is to create a .env.rb file in the root of the repository
containing:

ENV['LILA_SHELL_DATABASE_URL'] ||= 'postgres:///?user=lila_shell&password=...'
ENV['LILA_SHELL_SESSION_CIPHER_SECRET'] ||= '...'
ENV['LILA_SHELL_SESSION_HMAC_SECRET'] ||= '...'
ENV['LILA_SHELL_SESSION_SECRET'] ||= '...'

You can then run the server (via unicorn or another rack-compatible webserver):

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ task :web_test do
ENV['RACK_ENV'] = 'test'
ENV['PORT'] ||= '3001'
ENV['LILA_SHELL_DATABASE_URL'] ||= "postgres:///lila_shell_test?user=lila_shell"
ENV['LILA_SHELL_SESSION_SECRET'] ||= SecureRandom.base64(40)
ENV['LILA_SHELL_SESSION_SECRET'] ||= SecureRandom.base64(48)

sh "psql -U lila_shell -f test/clean.sql lila_shell_test"
Process.spawn("#{ENV['UNICORN']||'unicorn'} -E test -p #{ENV['PORT']} -D -c test/unicorn.conf")
Expand Down
2 changes: 1 addition & 1 deletion config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ begin
require 'refrigerator'
rescue LoadError
else
Refrigerator.freeze_core
Refrigerator.freeze_core(:except=>['BasicObject'])
end
3 changes: 1 addition & 2 deletions lila_shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class App < Roda

use Rack::CommonLogger
plugin :sessions,
:cipher_secret=>ENV.delete('LILA_SHELL_SESSION_CIPHER_SECRET'),
:hmac_secret=>ENV.delete('LILA_SHELL_SESSION_HMAC_SECRET'),
:secret=>ENV.delete('LILA_SHELL_SESSION_SECRET'),
:key=>'lila_shell.session'

MESSAGE_BUS = MessageBus::Instance.new
Expand Down
2 changes: 1 addition & 1 deletion test/web_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
require 'refrigerator'
rescue LoadError
else
Refrigerator.freeze_core
Refrigerator.freeze_core(:except=>['BasicObject'])
end

describe 'LilaShell' do
Expand Down

0 comments on commit 6393bd3

Please sign in to comment.