[#279] Web sessions use cookies instead of files on disk (M. Johnson)
This commit is contained in:
@@ -1217,10 +1217,10 @@ you're doing.
|
||||
|
||||
=head3 C<session>
|
||||
|
||||
Value: String. Default: C<YAML>.
|
||||
Value: String. Default: C<cookie>.
|
||||
|
||||
How to handle web sessions. Default is to store on disk so they can be shared
|
||||
between multiple web server processes (although it's slower).
|
||||
How to handle web sessions. Default is to store in an encrypted cookie
|
||||
using a key stored in the database by C<netdisco-deploy>.
|
||||
|
||||
=head3 C<template>
|
||||
|
||||
|
||||
@@ -56,6 +56,13 @@ if (setting('extra_web_plugins') and ref [] eq ref setting('extra_web_plugins'))
|
||||
push @{ config->{engines}->{netdisco_template_toolkit}->{INCLUDE_PATH} },
|
||||
setting('views');
|
||||
|
||||
# load cookie key from database
|
||||
setting('session_cookie_key' => undef);
|
||||
my $sessions = schema('netdisco')->resultset('Session');
|
||||
my $skey = $sessions->find({id => 'dancer_session_cookie_key'});
|
||||
setting('session_cookie_key' => $skey->get_column('a_session')) if $skey;
|
||||
Dancer::Session::Cookie::init(session);
|
||||
|
||||
# workaround for https://github.com/PerlDancer/Dancer/issues/935
|
||||
hook after_error_render => sub { setting('layout' => 'main') };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user