@@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
+ A `<host>:<admin_server_port>/ready` endpoint is available for checking a correct internal state(the database connection plus the schema cache). 200 OK = ready, 503 = not ready.
|
+ A `<host>:<admin_server_port>/ready` endpoint is available for checking a correct internal state(the database connection plus the schema cache). 200 OK = ready, 503 = not ready.
|
||||||
- #1988, Add the current user to the request log on stdout - @DavidLindbom, @wolfgangwalther
|
- #1988, Add the current user to the request log on stdout - @DavidLindbom, @wolfgangwalther
|
||||||
- #1991, Add the ability to run without `db-uri` using libpq's PG environment variables to connect. @wolfgangwalther
|
- #1991, Add the ability to run without `db-uri` using libpq's PG environment variables to connect. @wolfgangwalther
|
||||||
|
- #1769, Add the ability to run without `db-schemas`, defaulting to `db-schemas=public`. @wolfgangwalther
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ let
|
|||||||
''
|
''
|
||||||
# previously required settings to make this work with older branches
|
# previously required settings to make this work with older branches
|
||||||
export PGRST_DB_URI="postgresql://"
|
export PGRST_DB_URI="postgresql://"
|
||||||
|
export PGRST_DB_SCHEMAS="test"
|
||||||
|
|
||||||
export PGRST_DB_CONFIG="false"
|
export PGRST_DB_CONFIG="false"
|
||||||
export PGRST_DB_POOL="1"
|
export PGRST_DB_POOL="1"
|
||||||
|
|||||||
+2
-12
@@ -220,9 +220,8 @@ parser optPath env dbSettings =
|
|||||||
<*> (fromMaybe True <$> optBool "db-prepared-statements")
|
<*> (fromMaybe True <$> optBool "db-prepared-statements")
|
||||||
<*> (fmap toQi <$> optWithAlias (optString "db-root-spec")
|
<*> (fmap toQi <$> optWithAlias (optString "db-root-spec")
|
||||||
(optString "root-spec"))
|
(optString "root-spec"))
|
||||||
<*> (fromList . splitOnCommas <$> reqWithAlias (optValue "db-schemas")
|
<*> (fromList . maybe ["public"] splitOnCommas <$> optWithAlias (optValue "db-schemas")
|
||||||
(optValue "db-schema")
|
(optValue "db-schema"))
|
||||||
"missing key: either db-schemas or db-schema must be set")
|
|
||||||
<*> (fromMaybe True <$> optBool "db-config")
|
<*> (fromMaybe True <$> optBool "db-config")
|
||||||
<*> parseTxEnd "db-tx-end" snd
|
<*> parseTxEnd "db-tx-end" snd
|
||||||
<*> parseTxEnd "db-tx-end" fst
|
<*> parseTxEnd "db-tx-end" fst
|
||||||
@@ -317,15 +316,6 @@ parser optPath env dbSettings =
|
|||||||
Nothing -> pure [JSPKey "role"]
|
Nothing -> pure [JSPKey "role"]
|
||||||
Just rck -> either (fail . show) pure $ pRoleClaimKey rck
|
Just rck -> either (fail . show) pure $ pRoleClaimKey rck
|
||||||
|
|
||||||
reqWithAlias :: C.Parser C.Config (Maybe a) -> C.Parser C.Config (Maybe a) -> [Char] -> C.Parser C.Config a
|
|
||||||
reqWithAlias orig alias err =
|
|
||||||
orig >>= \case
|
|
||||||
Just v -> pure v
|
|
||||||
Nothing ->
|
|
||||||
alias >>= \case
|
|
||||||
Just v -> pure v
|
|
||||||
Nothing -> fail err
|
|
||||||
|
|
||||||
optWithAlias :: C.Parser C.Config (Maybe a) -> C.Parser C.Config (Maybe a) -> C.Parser C.Config (Maybe a)
|
optWithAlias :: C.Parser C.Config (Maybe a) -> C.Parser C.Config (Maybe a) -> C.Parser C.Config (Maybe a)
|
||||||
optWithAlias orig alias =
|
optWithAlias orig alias =
|
||||||
orig >>= \case
|
orig >>= \case
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
db-schemas = "required"
|
|
||||||
db-anon-role = "required"
|
db-anon-role = "required"
|
||||||
|
|
||||||
db-channel-enabled = "1"
|
db-channel-enabled = "1"
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
db-schemas = "required"
|
|
||||||
db-anon-role = "required"
|
db-anon-role = "required"
|
||||||
|
|
||||||
db-channel-enabled = "true"
|
db-channel-enabled = "true"
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
db-schemas = "required"
|
|
||||||
db-anon-role = "required"
|
db-anon-role = "required"
|
||||||
# Not the default, but only works with PG* variables, which are not set
|
# Not the default, but only works with PG* variables, which are not set
|
||||||
db-config = false
|
db-config = false
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ db-pool-timeout = 10
|
|||||||
db-pre-request = ""
|
db-pre-request = ""
|
||||||
db-prepared-statements = false
|
db-prepared-statements = false
|
||||||
db-root-spec = ""
|
db-root-spec = ""
|
||||||
db-schemas = "required"
|
db-schemas = "public"
|
||||||
db-config = true
|
db-config = true
|
||||||
db-tx-end = "commit"
|
db-tx-end = "commit"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ db-pool-timeout = 10
|
|||||||
db-pre-request = ""
|
db-pre-request = ""
|
||||||
db-prepared-statements = false
|
db-prepared-statements = false
|
||||||
db-root-spec = ""
|
db-root-spec = ""
|
||||||
db-schemas = "required"
|
db-schemas = "public"
|
||||||
db-config = true
|
db-config = true
|
||||||
db-tx-end = "commit"
|
db-tx-end = "commit"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ db-pool-timeout = 10
|
|||||||
db-pre-request = ""
|
db-pre-request = ""
|
||||||
db-prepared-statements = true
|
db-prepared-statements = true
|
||||||
db-root-spec = ""
|
db-root-spec = ""
|
||||||
db-schemas = "required"
|
db-schemas = "public"
|
||||||
db-config = false
|
db-config = false
|
||||||
db-tx-end = "commit"
|
db-tx-end = "commit"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ db-pool-timeout = 10
|
|||||||
db-pre-request = ""
|
db-pre-request = ""
|
||||||
db-prepared-statements = true
|
db-prepared-statements = true
|
||||||
db-root-spec = ""
|
db-root-spec = ""
|
||||||
db-schemas = "required"
|
db-schemas = "public"
|
||||||
db-config = true
|
db-config = true
|
||||||
db-tx-end = "commit"
|
db-tx-end = "commit"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# will be replaced in test
|
||||||
db-schemas = "public"
|
db-schemas = "public"
|
||||||
|
|
||||||
app.settings.name_var = "John"
|
app.settings.name_var = "John"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
# tests how config options fall back with invalid types
|
# tests how config options fall back with invalid types
|
||||||
db-anon-role = "required"
|
db-anon-role = "required"
|
||||||
db-schemas = "required"
|
|
||||||
|
|
||||||
# expects string
|
# expects string
|
||||||
app.settings.test = false
|
app.settings.test = false
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ cli:
|
|||||||
- name: missing db-anon-role
|
- name: missing db-anon-role
|
||||||
expect: error
|
expect: error
|
||||||
env:
|
env:
|
||||||
PGRST_DB_SCHEMAS: required
|
|
||||||
- name: missing db-schemas
|
|
||||||
expect: error
|
|
||||||
env:
|
|
||||||
PGRST_DB_ANON_ROLE: required
|
|
||||||
# failures: wrong config values
|
# failures: wrong config values
|
||||||
- name: invalid server-unix-socket-mode not octal
|
- name: invalid server-unix-socket-mode not octal
|
||||||
expect: error
|
expect: error
|
||||||
|
|||||||
+1
-4
@@ -92,7 +92,6 @@ def defaultenv():
|
|||||||
"PGDATABASE": os.environ["PGDATABASE"],
|
"PGDATABASE": os.environ["PGDATABASE"],
|
||||||
"PGHOST": os.environ["PGHOST"],
|
"PGHOST": os.environ["PGHOST"],
|
||||||
"PGUSER": os.environ["PGUSER"],
|
"PGUSER": os.environ["PGUSER"],
|
||||||
"PGRST_DB_SCHEMAS": "public",
|
|
||||||
"PGRST_DB_ANON_ROLE": os.environ["PGRST_DB_ANON_ROLE"],
|
"PGRST_DB_ANON_ROLE": os.environ["PGRST_DB_ANON_ROLE"],
|
||||||
"PGRST_DB_CONFIG": "false",
|
"PGRST_DB_CONFIG": "false",
|
||||||
"PGRST_LOG_LEVEL": "info",
|
"PGRST_LOG_LEVEL": "info",
|
||||||
@@ -641,9 +640,7 @@ def test_db_schema_reload(tmp_path, defaultenv):
|
|||||||
configfile = tmp_path / "test.config"
|
configfile = tmp_path / "test.config"
|
||||||
configfile.write_text(config)
|
configfile.write_text(config)
|
||||||
|
|
||||||
env = {key: value for key, value in defaultenv.items() if key != "PGRST_DB_SCHEMAS"}
|
with run(configfile, env=defaultenv) as postgrest:
|
||||||
|
|
||||||
with run(configfile, env=env) as postgrest:
|
|
||||||
response = postgrest.session.get("/rpc/get_guc_value?name=search_path")
|
response = postgrest.session.get("/rpc/get_guc_value?name=search_path")
|
||||||
assert response.text == '"public, public"'
|
assert response.text == '"public, public"'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user