refactor: App.hs and related changes (#1725)

* Use ExceptT to avoid 'staircasing' case analysis in App.hs
* Split large function in App.hs into individual handler functions
* Adapt API of Auth.hs, OpenApi.hs etc. to simplify the use of those modules in App.hs
* Split optional rollback functionality into Middleware
* Unify SimpleError and ApiRequestError into one Error type, so it can be used across modules
This commit is contained in:
Remo Rechkemmer
2021-02-23 22:41:48 +01:00
committed by GitHub
parent 0ddd676ef0
commit e6973f966b
11 changed files with 734 additions and 567 deletions
+1 -2
View File
@@ -22,8 +22,7 @@ import Test.Hspec
import Test.Hspec.Wai
import Text.Heredoc
import PostgREST.Auth (parseSecret)
import PostgREST.Config (AppConfig (..))
import PostgREST.Config (AppConfig (..), parseSecret)
import PostgREST.Types (JSPathExp (..), LogLevel (..))
import Protolude hiding (toS)
import Protolude.Conv (toS)
+2
View File
@@ -297,6 +297,7 @@ def test_expected_config_from_db_settings(defaultenv, role, expectedconfig):
assert dumpconfig(configpath=config, env=env) == expected
@pytest.mark.parametrize(
"config",
[conf for conf in CONFIGSDIR.iterdir() if conf.suffix == ".config"],
@@ -604,6 +605,7 @@ def test_max_rows_notify_reload(defaultenv):
# reset max-rows config on the db
postgrest.session.post("/rpc/reset_max_rows_config")
def test_invalid_role_claim_key_notify_reload(defaultenv):
"NOTIFY reload config should show an error if role-claim-key is invalid"