16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'bridgetown-core/lib/roda/plugins/bridgetown_ssr.rb', line 16
def self.load_dependencies(app, opts = { sessions: false })
app.plugin :all_verbs
app.plugin :cookies, path: "/"
app.plugin :indifferent_params
app.plugin :method_override
app.plugin :route_csrf
app.plugin :custom_block_results
app.handle_block_result(Bridgetown::RodaCallable) do |callable|
request.send :block_result_body, callable.(self)
end
return unless opts[:sessions]
secret_key = ENV.fetch("RODA_SECRET_KEY", nil)
unless secret_key
raise Bridgetown::Errors::InvalidConfigurationError,
"The Roda sessions plugin can't find a valid secret. Run " \
"`bin/bridgetown secret' and put the key in your ENV as the " \
"RODA_SECRET_KEY variable"
end
app.plugin :sessions, secret: secret_key
app.plugin :flashier
end
|