fix: in-db config values not loading for pgrst.server_trace_header and pgrst.server_cors_allowed_origins

This commit is contained in:
Laurence Isla
2024-03-27 15:59:35 -05:00
parent d02540ac44
commit 428a6fef63
8 changed files with 27 additions and 19 deletions
@@ -27,7 +27,7 @@ log-level = "info"
openapi-mode = "disabled"
openapi-security-active = false
openapi-server-proxy-uri = "https://otherexample.org/api"
server-cors-allowed-origins = "http://example.com"
server-cors-allowed-origins = "http://otherorigin.com"
server-host = "0.0.0.0"
server-port = 80
server-trace-header = "traceparent"
@@ -27,7 +27,7 @@ log-level = "info"
openapi-mode = "ignore-privileges"
openapi-security-active = true
openapi-server-proxy-uri = "https://example.org/api"
server-cors-allowed-origins = "http://example.com"
server-cors-allowed-origins = "http://origin.com"
server-host = "0.0.0.0"
server-port = 80
server-trace-header = "CF-Ray"
+2 -2
View File
@@ -19,7 +19,7 @@ ALTER ROLE db_config_authenticator SET pgrst.db_pre_request = 'test.custom_heade
ALTER ROLE db_config_authenticator SET pgrst.db_max_rows = '1000';
ALTER ROLE db_config_authenticator SET pgrst.db_extra_search_path = 'public, extensions';
ALTER ROLE db_config_authenticator SET pgrst.not_existing = 'should be ignored';
ALTER ROLE db_config_authenticator SET pgrst.server_cors_allowed_origins = 'http://example.com';
ALTER ROLE db_config_authenticator SET pgrst.server_cors_allowed_origins = 'http://origin.com';
ALTER ROLE db_config_authenticator SET pgrst.server_trace_header = 'CF-Ray';
ALTER ROLE db_config_authenticator SET pgrst.server_timing_enabled = 'true';
@@ -66,7 +66,7 @@ ALTER ROLE other_authenticator SET pgrst.db_max_rows = '100';
ALTER ROLE other_authenticator SET pgrst.db_extra_search_path = 'public, extensions, other';
ALTER ROLE other_authenticator SET pgrst.openapi_mode = 'disabled';
ALTER ROLE other_authenticator SET pgrst.openapi_security_active = 'false';
ALTER ROLE other_authenticator SET pgrst.server_cors_allowed_origins = 'http://example.com';
ALTER ROLE other_authenticator SET pgrst.server_cors_allowed_origins = 'http://otherorigin.com';
ALTER ROLE other_authenticator SET pgrst.server_trace_header = 'traceparent';
ALTER ROLE other_authenticator SET pgrst.db_pre_config = 'postgrest.pre_config';
ALTER ROLE other_authenticator SET pgrst.server_timing_enabled = 'true';
+2 -2
View File
@@ -83,7 +83,7 @@ main = do
appState <- AppState.initWithPool sockets pool config noObs
AppState.putPgVersion appState actualPgVersion
AppState.putSchemaCache appState (Just baseSchemaCache)
return ((), postgrest config appState (pure ()) noObs)
return ((), postgrest (configLogLevel config) appState (pure ()) noObs)
-- For tests that run with a different SchemaCache(depends on configSchemas)
appDbs config = do
@@ -91,7 +91,7 @@ main = do
appState <- AppState.initWithPool sockets pool config noObs
AppState.putPgVersion appState actualPgVersion
AppState.putSchemaCache appState (Just customSchemaCache)
return ((), postgrest config appState (pure ()) noObs)
return ((), postgrest (configLogLevel config) appState (pure ()) noObs)
let withApp = app testCfg
maxRowsApp = app testMaxRowsCfg