diff --git a/CHANGELOG.md b/CHANGELOG.md index b83e0207d0..371f5c6cb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - #3533, #3536, Fix listener silently failing on read replica - @steve-chavez + If the LISTEN connection fails, it's retried with exponential backoff - #3414, Force listener to connect to read-write instances using `target_session_attrs` - @steve-chavez + - #3508, Server port and admin server port can end up with the same value - @develop7 + + The app is fails to start when the server port and admin server port are the same ### Deprecated diff --git a/src/PostgREST/Config.hs b/src/PostgREST/Config.hs index ef2a7813cc..e76721ae0e 100644 --- a/src/PostgREST/Config.hs +++ b/src/PostgREST/Config.hs @@ -221,12 +221,21 @@ readAppConfig dbSettings optPath prevDbUri roleSettings roleIsolationLvl = do Left err -> return . Left $ "Error in config " <> err Right parsedConfig -> - Right <$> decodeLoadFiles parsedConfig + case processForbiddenValues parsedConfig of + Left err' -> + return . Left $ "Error in config " <> err' + Right config -> + Right <$> decodeLoadFiles config where -- Both C.ParseError and IOError are shown here loadConfig :: FilePath -> IO (Either SomeException C.Config) loadConfig = try . C.load + processForbiddenValues :: AppConfig -> Either Text AppConfig + processForbiddenValues cfg@AppConfig{..} + | configAdminServerPort == Just configServerPort = Left "admin-server-port cannot be the same as server-port" + | otherwise = Right cfg + decodeLoadFiles :: AppConfig -> IO AppConfig decodeLoadFiles parsedConfig = decodeJWKS <$>