update lts and log headers

This commit is contained in:
Lucy Cifferello
2021-09-08 15:39:42 -06:00
committed by Keagan McClelland
parent 6b649f6c8b
commit 8a675b48fe
3 changed files with 4 additions and 11 deletions

View File

@@ -18,7 +18,7 @@ ip-from-header: "_env:YESOD_IP_FROM_HEADER:false"
# Optional values with the following production defaults. # Optional values with the following production defaults.
# In development, they default to the inverse. # In development, they default to the inverse.
# #
detailed-logging: true detailed-logging: false
# should-log-all: false # should-log-all: false
# reload-templates: false # reload-templates: false
# mutable-static: false # mutable-static: false

View File

@@ -64,6 +64,7 @@ import Control.Lens
import Control.Arrow ((***)) import Control.Arrow ((***))
import Network.HTTP.Types.Header ( hOrigin ) import Network.HTTP.Types.Header ( hOrigin )
import Data.List (lookup) import Data.List (lookup)
import Network.Wai.Middleware.RequestLogger.JSON
-- This line actually creates our YesodDispatch instance. It is the second half -- 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 -- 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 :: Request -> Maybe CorsResourcePolicy
dynamicCorsResourcePolicy req = Just . policy . lookup hOrigin $ requestHeaders req dynamicCorsResourcePolicy req = Just . policy . lookup hOrigin $ requestHeaders req
$logInfo $ show $ requestHeaders req
where where
policy o = simpleCorsResourcePolicy policy o = simpleCorsResourcePolicy
{ corsOrigins = (\o' -> ([o'], True)) <$> o { corsOrigins = (\o' -> ([o'], True)) <$> o
@@ -181,10 +181,6 @@ dynamicCorsResourcePolicy req = Just . policy . lookup hOrigin $ requestHeaders
] ]
, corsIgnoreFailures = True , 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 :: RegistryCtx -> IO Middleware
makeLogWare foundation = makeLogWare foundation =
@@ -192,14 +188,10 @@ makeLogWare foundation =
{ outputFormat = { outputFormat =
if appDetailedRequestLogging $ appSettings foundation if appDetailedRequestLogging $ appSettings foundation
then Detailed True then Detailed True
else Apache else CustomOutputFormatWithDetailsAndHeaders formatAsJSONWithHeaders
(if appIpFromHeader $ appSettings foundation
then FromFallback
else FromSocket)
, destination = Logger $ loggerSet $ appLogger foundation , destination = Logger $ loggerSet $ appLogger foundation
} }
-- TODO : what kind of auth is needed here
makeAuthWare :: RegistryCtx -> Middleware makeAuthWare :: RegistryCtx -> Middleware
makeAuthWare _ app req res = next makeAuthWare _ app req res = next
where where

View File

@@ -18,6 +18,7 @@ import qualified Yesod.Core.Unsafe as Unsafe
import Settings import Settings
import Yesod.Persist.Core import Yesod.Persist.Core
import Lib.Types.AppIndex import Lib.Types.AppIndex
import Network.Wai
-- | The foundation datatype for your application. This can be a good place to -- | The foundation datatype for your application. This can be a good place to
-- keep settings and values requiring initialization before your application -- keep settings and values requiring initialization before your application