Skip to content

Commit

Permalink
Change server-proxy-uri 2 openapi-server-proxy-uri
Browse files Browse the repository at this point in the history
The server-proxy-uri config option mislead into thinking it was a
web server global setting when it's only related to OpenAPI.
  • Loading branch information
steve-chavez committed Feb 2, 2020
1 parent 9b12248 commit b75e7ce
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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= \
Expand Down
2 changes: 1 addition & 1 deletion docker/postgrest.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
2 changes: 1 addition & 1 deletion main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/PostgREST/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/PostgREST/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/SpecHelper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b75e7ce

Please sign in to comment.