Skip to content

Commit

Permalink
Adding in the new RequestId handler. (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoertink committed Nov 29, 2021
1 parent 6ae145e commit a5a3f4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/web_app_skeleton/config/server.cr.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ Lucky::ForceSSLHandler.configure do |settings|
settings.enabled = false
end

# Set a uniuqe ID for each HTTP request.
Lucky::RequestIdHandler.configure do |settings|
# To enable the request ID, uncomment the lines below.
# You can set your own custom String, or use a random UUID.
#
# settings.set_request_id = ->(context : HTTP::Server::Context) {
# UUID.random.to_s
# }
end

private def secret_key_from_env
ENV["SECRET_KEY_BASE"]? || raise_missing_secret_key_in_production
end
Expand Down
1 change: 1 addition & 0 deletions src/web_app_skeleton/src/app_server.cr.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class AppServer < Lucky::BaseAppServer
# https://luckyframework.org/guides/http-and-routing/http-handlers
def middleware : Array(HTTP::Handler)
[
Lucky::RequestIdHandler.new,
Lucky::ForceSSLHandler.new,
Lucky::HttpMethodOverrideHandler.new,
Lucky::LogHandler.new,
Expand Down

0 comments on commit a5a3f4b

Please sign in to comment.