From 8a675b48fee65846a744ed548675bee77affd503 Mon Sep 17 00:00:00 2001 From: Lucy Cifferello <12953208+elvece@users.noreply.github.com> Date: Wed, 8 Sep 2021 15:39:42 -0600 Subject: [PATCH] update lts and log headers --- config/settings.yml | 2 +- src/Application.hs | 12 ++---------- src/Foundation.hs | 1 + 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/config/settings.yml b/config/settings.yml index b3caa79..c5c0020 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -18,7 +18,7 @@ ip-from-header: "_env:YESOD_IP_FROM_HEADER:false" # Optional values with the following production defaults. # In development, they default to the inverse. # -detailed-logging: true +detailed-logging: false # should-log-all: false # reload-templates: false # mutable-static: false diff --git a/src/Application.hs b/src/Application.hs index 5370c83..d231161 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -64,6 +64,7 @@ import Control.Lens import Control.Arrow ((***)) import Network.HTTP.Types.Header ( hOrigin ) import Data.List (lookup) +import Network.Wai.Middleware.RequestLogger.JSON -- This line actually creates our YesodDispatch instance. It is the second half -- of the call to mkYesodData which occurs in Foundation.hs. Please see the @@ -118,7 +119,6 @@ makeApplication foundation = do dynamicCorsResourcePolicy :: Request -> Maybe CorsResourcePolicy dynamicCorsResourcePolicy req = Just . policy . lookup hOrigin $ requestHeaders req - $logInfo $ show $ requestHeaders req where policy o = simpleCorsResourcePolicy { corsOrigins = (\o' -> ([o'], True)) <$> o @@ -181,10 +181,6 @@ dynamicCorsResourcePolicy req = Just . policy . lookup hOrigin $ requestHeaders ] , corsIgnoreFailures = True } --- TODO: create a middle ware which will attempt to verify an ecdsa signed transaction against one of the public keys --- in the validDevices table. --- makeCheckSigWare :: RegistryCtx -> IO Middleware --- makeCheckSigWare = _ makeLogWare :: RegistryCtx -> IO Middleware makeLogWare foundation = @@ -192,14 +188,10 @@ makeLogWare foundation = { outputFormat = if appDetailedRequestLogging $ appSettings foundation then Detailed True - else Apache - (if appIpFromHeader $ appSettings foundation - then FromFallback - else FromSocket) + else CustomOutputFormatWithDetailsAndHeaders formatAsJSONWithHeaders , destination = Logger $ loggerSet $ appLogger foundation } --- TODO : what kind of auth is needed here makeAuthWare :: RegistryCtx -> Middleware makeAuthWare _ app req res = next where diff --git a/src/Foundation.hs b/src/Foundation.hs index d3167c5..f1e8cf5 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -18,6 +18,7 @@ import qualified Yesod.Core.Unsafe as Unsafe import Settings import Yesod.Persist.Core import Lib.Types.AppIndex +import Network.Wai -- | The foundation datatype for your application. This can be a good place to -- keep settings and values requiring initialization before your application