From b75e7cef906b1703eb14ffcc32723eacff30ee11 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Mon, 27 Jan 2020 16:35:48 -0500 Subject: [PATCH] Change server-proxy-uri 2 openapi-server-proxy-uri The server-proxy-uri config option mislead into thinking it was a web server global setting when it's only related to OpenAPI. --- CHANGELOG.md | 1 + docker/Dockerfile | 2 +- docker/postgrest.conf | 2 +- main/Main.hs | 2 +- src/PostgREST/App.hs | 2 +- src/PostgREST/Config.hs | 6 +++--- test/SpecHelper.hs | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2cd5127f..f6bc56e64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - #1423, default Unix Socket file mode from 755 to 660 - @dwagin - #1430, Remove embedding with duck typed column names `GET /projects?select=client(*)`- @steve-chavez + You can rename the foreign key to `client` to make this request work in the new version: `alter table projects rename constraint projects_client_id_fkey to client` +- #1413, Change `server-proxy-uri` config option to `openapi-server-proxy-uri` - @steve-chavez ## [6.0.2] - 2019-08-22 diff --git a/docker/Dockerfile b/docker/Dockerfile index 0b80b6054..01149350c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -31,7 +31,7 @@ ENV PGRST_DB_URI= \ PGRST_DB_EXTRA_SEARCH_PATH=public \ PGRST_SERVER_HOST=*4 \ PGRST_SERVER_PORT=3000 \ - PGRST_SERVER_PROXY_URI= \ + PGRST_OPENAPI_SERVER_PROXY_URI= \ PGRST_JWT_SECRET= \ PGRST_SECRET_IS_BASE64=false \ PGRST_JWT_AUD= \ diff --git a/docker/postgrest.conf b/docker/postgrest.conf index faf8af57f..c1b5b9bd7 100644 --- a/docker/postgrest.conf +++ b/docker/postgrest.conf @@ -7,7 +7,7 @@ db-extra-search-path = "$(PGRST_DB_EXTRA_SEARCH_PATH)" server-host = "$(PGRST_SERVER_HOST)" server-port = "$(PGRST_SERVER_PORT)" -server-proxy-uri = "$(PGRST_SERVER_PROXY_URI)" +openapi-server-proxy-uri = "$(PGRST_OPENAPI_SERVER_PROXY_URI)" jwt-secret = "$(PGRST_JWT_SECRET)" secret-is-base64 = "$(PGRST_SECRET_IS_BASE64)" jwt-aud = "$(PGRST_JWT_AUD)" diff --git a/main/Main.hs b/main/Main.hs index 0438e7e96..1d03fe421 100644 --- a/main/Main.hs +++ b/main/Main.hs @@ -164,7 +164,7 @@ main = do conf <- loadDbUriFile =<< loadSecretFile =<< readOptions let host = configHost conf port = configPort conf - proxy = configProxyUri conf + proxy = configOpenAPIProxyUri conf maybeSocketAddr = configSocket conf socketFileMode = configSocketMode conf pgSettings = toS (configDatabase conf) -- is the db-uri diff --git a/src/PostgREST/App.hs b/src/PostgREST/App.hs index 3f3dcffc4..477ae30bf 100644 --- a/src/PostgREST/App.hs +++ b/src/PostgREST/App.hs @@ -311,7 +311,7 @@ app dbStructure proc cols conf apiRequest = (ActionInspect headersOnly, TargetDefaultSpec tSchema, Nothing) -> do let host = configHost conf port = toInteger $ configPort conf - proxy = pickProxy $ toS <$> configProxyUri conf + proxy = pickProxy $ toS <$> configOpenAPIProxyUri conf uri Nothing = ("http", host, port, "/") uri (Just Proxy { proxyScheme = s, proxyHost = h, proxyPort = p, proxyPath = b }) = (s, h, p, b) uri' = uri proxy diff --git a/src/PostgREST/Config.hs b/src/PostgREST/Config.hs index a4500ea38..bba7f5c1a 100644 --- a/src/PostgREST/Config.hs +++ b/src/PostgREST/Config.hs @@ -70,7 +70,7 @@ import Protolude hiding (concat, hPutStrLn, intercalate, null, data AppConfig = AppConfig { configDatabase :: Text , configAnonRole :: Text - , configProxyUri :: Maybe Text + , configOpenAPIProxyUri :: Maybe Text , configSchema :: Text , configHost :: Text , configPort :: Int @@ -154,7 +154,7 @@ readOptions = do AppConfig <$> reqString "db-uri" <*> reqString "db-anon-role" - <*> optString "server-proxy-uri" + <*> optString "openapi-server-proxy-uri" <*> reqString "db-schema" <*> (fromMaybe "!4" <$> optString "server-host") <*> (fromMaybe 3000 <$> optInt "server-port") @@ -271,7 +271,7 @@ readOptions = do |# server-unix-socket-mode = "660" | |## base url for swagger output - |# server-proxy-uri = "" + |# openapi-server-proxy-uri = "" | |## choose a secret, JSON Web Key (or set) to enable JWT auth |## (use "@filename" to load from separate file) diff --git a/test/SpecHelper.hs b/test/SpecHelper.hs index 882732487..b577e2853 100644 --- a/test/SpecHelper.hs +++ b/test/SpecHelper.hs @@ -99,7 +99,7 @@ testMaxRowsCfg :: Text -> AppConfig testMaxRowsCfg testDbConn = (testCfg testDbConn) { configMaxRows = Just 2 } testProxyCfg :: Text -> AppConfig -testProxyCfg testDbConn = (testCfg testDbConn) { configProxyUri = Just "https://postgrest.com/openapi.json" } +testProxyCfg testDbConn = (testCfg testDbConn) { configOpenAPIProxyUri = Just "https://postgrest.com/openapi.json" } testCfgBinaryJWT :: Text -> AppConfig testCfgBinaryJWT testDbConn = (testCfg testDbConn) {