Skip to content

Commit

Permalink
Render configuration on the admin /config path
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyWriter committed Jan 28, 2024
1 parent 43f552d commit 459486f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/PostgREST/Admin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ import qualified Network.Wai.Handler.Warp as Warp

import Control.Monad.Extra (whenJust)

import qualified Data.ByteString.Lazy as LBS

import Network.Socket
import Network.Socket.ByteString

import PostgREST.AppState (AppState)
import PostgREST.Config (AppConfig (..))

import qualified PostgREST.AppState as AppState
import qualified PostgREST.Config as Config

import Protolude
import Protolude.Partial (fromJust)
Expand Down Expand Up @@ -45,6 +48,9 @@ admin appState appConfig req respond = do
respond $ Wai.responseLBS (if isMainAppReachable && isConnectionUp && isSchemaCacheLoaded then HTTP.status200 else HTTP.status503) [] mempty
["live"] ->
respond $ Wai.responseLBS (if isMainAppReachable then HTTP.status200 else HTTP.status503) [] mempty
["config"] -> do
config <- AppState.getConfig appState
respond $ Wai.responseLBS HTTP.status200 [] (LBS.fromStrict $ encodeUtf8 $ Config.toText config)

Check warning on line 53 in src/PostgREST/Admin.hs

View check run for this annotation

Codecov / codecov/patch

src/PostgREST/Admin.hs#L51-L53

Added lines #L51 - L53 were not covered by tests
_ ->
respond $ Wai.responseLBS HTTP.status404 [] mempty

Expand Down

0 comments on commit 459486f

Please sign in to comment.