diff --git a/CHANGELOG.md b/CHANGELOG.md index bf67a8390..40e974e0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -610,7 +610,7 @@ All notable changes to this project will be documented in this file. From versio ### Added - #1933, #2109, Add a minimal health check endpoint - @steve-chavez - + For enabling this, the `admin-server-port` config must be set explictly + + For enabling this, the `admin-server-port` config must be set explicitly + A `:/live` endpoint is available for checking if postgrest is running on its port/socket. 200 OK = alive, 503 = dead. + A `:/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 @@ -1093,7 +1093,7 @@ All notable changes to this project will be documented in this file. From versio - Customize content negotiation per route - @begriffs - Allow using nulls order without explicit order direction - @steve-chavez - Fatal error on postgres unsupported version, format supported version in error message - @steve-chavez -- Prevent database memory cosumption by prepared statements caches - @ruslantalpa +- Prevent database memory consumption by prepared statements caches - @ruslantalpa - Use specific columns in the RETURNING section - @ruslantalpa - Fix columns alias for RETURNING - @steve-chavez diff --git a/docs/conf.py b/docs/conf.py index b7ba4d1fe..1a3bf734f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,7 +48,7 @@ source_suffix = ".rst" # The master toctree document. master_doc = "index" -# This is overriden by readthedocs with the version tag anyway +# This is overridden by readthedocs with the version tag anyway version = "devel" # To avoid repetition in we set this to an empty string. release = "" diff --git a/docs/ecosystem.rst b/docs/ecosystem.rst index 1885cdfe2..9741b9d20 100644 --- a/docs/ecosystem.rst +++ b/docs/ecosystem.rst @@ -6,7 +6,7 @@ Community Tutorials * `Building a Contacts List with PostgREST and Vue.js <https://www.youtube.com/watch?v=iHtsALtD5-U>`_ - In this video series, DigitalOcean shows how to build and deploy an Nginx + PostgREST(using a managed PostgreSQL database) + Vue.js webapp in an Ubuntu server droplet. -* `PostgREST + Auth0: Create REST API in mintutes, and add social login using Auth0 <https://samkhawase.com/blog/postgrest/>`_ - A step-by-step tutorial to show how to dockerize and integrate Auth0 to PostgREST service. +* `PostgREST + Auth0: Create REST API in minutes, and add social login using Auth0 <https://samkhawase.com/blog/postgrest/>`_ - A step-by-step tutorial to show how to dockerize and integrate Auth0 to PostgREST service. * `"CodeLess" backend using postgres, postgrest and oauth2 authentication with keycloak <https://www.mathieupassenaud.fr/codeless_backend/>`_ - A step-by-step tutorial for using PostgREST with KeyCloak(hosted on a managed service). diff --git a/docs/explanations/db_authz.rst b/docs/explanations/db_authz.rst index 9239f4f39..b7085344a 100644 --- a/docs/explanations/db_authz.rst +++ b/docs/explanations/db_authz.rst @@ -163,7 +163,7 @@ Another option is to define the function with the :code:`SECURITY DEFINER` optio .. code-block:: postgres - -- login as a user wich has privileges on the private schemas + -- login as a user which has privileges on the private schemas -- create a sample function create or replace function login(email text, pass text, out token text) as $$ diff --git a/docs/references/api/media_type_handlers.rst b/docs/references/api/media_type_handlers.rst index cd39399ad..78ea46af2 100644 --- a/docs/references/api/media_type_handlers.rst +++ b/docs/references/api/media_type_handlers.rst @@ -15,7 +15,7 @@ Using these domains, :ref:`functions <functions>` can become handlers and `user- .. important:: - - PostgREST vendor media types (``application/vnd.pgrst.plan``, ``application/vnd.pgrst.object`` and ``application/vnd.pgrst.array``) cannot be overriden. + - PostgREST vendor media types (``application/vnd.pgrst.plan``, ``application/vnd.pgrst.object`` and ``application/vnd.pgrst.array``) cannot be overridden. - Long media types like ``application/vnd.openxmlformats-officedocument.wordprocessingml.document`` cannot be expressed as domains since they surpass `PostgreSQL identifier length <https://www.postgresql.org/docs/current/limits.html#LIMITS-TABLE>`_. For these you can use the :ref:`any_handler`. diff --git a/docs/references/api/resource_embedding.rst b/docs/references/api/resource_embedding.rst index 4ffad5905..881bc7402 100644 --- a/docs/references/api/resource_embedding.rst +++ b/docs/references/api/resource_embedding.rst @@ -1244,7 +1244,7 @@ You can order the correlated arrays explicitly. For example, to order by the fil .. warning:: - Aliasing spreaded columns is recommended since JSON allows duplicate keys. Example: + Aliasing spread columns is recommended since JSON allows duplicate keys. Example: .. code-block:: bash diff --git a/docs/references/api/tables_views.rst b/docs/references/api/tables_views.rst index 56ac679d8..ade8abf31 100644 --- a/docs/references/api/tables_views.rst +++ b/docs/references/api/tables_views.rst @@ -639,7 +639,7 @@ However, it can work with surrogate primary keys (e.g. ``id serial primary key`` .. code-block:: bash - curl "http://localhost:3000/employees?colums=id,name,salary" \ + curl "http://localhost:3000/employees?columns=id,name,salary" \ -X POST -H "Content-Type: application/json" \ -H "Prefer: resolution=merge-duplicates, missing=default" \ -d @- << EOF diff --git a/docs/references/auth.rst b/docs/references/auth.rst index b92bd8c21..4970dd39a 100644 --- a/docs/references/auth.rst +++ b/docs/references/auth.rst @@ -217,7 +217,7 @@ It's recommended to leave the JWT cache enabled as our load tests indicate ~20% - If the ``jwt-secret`` is changed and the config is reloaded, the JWT cache will reset. - JWTs that pass :ref:`jwt_signature` are cached, regardless if they pass :ref:`jwt_claims_validation`. We do this to ensure responses stays fast under common failure cases (such as expired JWTs). - - You can use the :ref:`server-timing_header` to see the peformance benefit of JWT caching. + - You can use the :ref:`server-timing_header` to see the performance benefit of JWT caching. .. _jwt_role_extract: diff --git a/docs/references/configuration.rst b/docs/references/configuration.rst index c3b563f1f..82800f36f 100644 --- a/docs/references/configuration.rst +++ b/docs/references/configuration.rst @@ -264,7 +264,7 @@ db-channel-enabled When this is set to :code:`true`, the notification channel specified in :ref:`db-channel` is enabled. - You should set this to ``false`` when using PostgresSQL behind an external connection pooler such as PgBouncer working in transaction pooling mode. See :ref:`this section <external_connection_poolers>` for more information. + You should set this to ``false`` when using PostgreSQL behind an external connection pooler such as PgBouncer working in transaction pooling mode. See :ref:`this section <external_connection_poolers>` for more information. .. _db-config: @@ -479,7 +479,7 @@ db-prepared-statements When disabled, the generated queries will be parameterized (invulnerable to SQL injection) but they will not be prepared (cached in the database session). Not using prepared statements will noticeably decrease performance, so it's recommended to always have this setting enabled. - You should only set this to ``false`` when using PostgresSQL behind an external connection pooler such as PgBouncer working in transaction pooling mode. See :ref:`this section <external_connection_poolers>` for more information. + You should only set this to ``false`` when using PostgreSQL behind an external connection pooler such as PgBouncer working in transaction pooling mode. See :ref:`this section <external_connection_poolers>` for more information. .. _db-root-spec: diff --git a/docs/references/transactions.rst b/docs/references/transactions.rst index 79175ef77..a7828ef31 100644 --- a/docs/references/transactions.rst +++ b/docs/references/transactions.rst @@ -221,7 +221,7 @@ Notice that the ``response.headers`` should be set to an *array* of single-key o .. note:: - PostgREST provided headers such as ``Content-Type``, ``Location``, etc. can be overriden this way. Note that irrespective of overridden ``Content-Type`` response header, the content will still be converted to JSON, unless you use :ref:`custom_media`. + PostgREST provided headers such as ``Content-Type``, ``Location``, etc. can be overridden this way. Note that irrespective of overridden ``Content-Type`` response header, the content will still be converted to JSON, unless you use :ref:`custom_media`. .. _guc_resp_status: diff --git a/nix/tools/devTools.nix b/nix/tools/devTools.nix index dd25d3bef..4fbd8068c 100644 --- a/nix/tools/devTools.nix +++ b/nix/tools/devTools.nix @@ -204,7 +204,7 @@ let ${git}/bin/git add . ;; pre-push) - # Create a clean working tree without any uncomitted changes. + # Create a clean working tree without any uncommitted changes. ${withTools.withGit} HEAD ${style}/bin/postgrest-lint ;; esac @@ -231,7 +231,7 @@ let ${style}/bin/postgrest-lint ;; pre-push) - # Create a clean working tree without any uncomitted changes. + # Create a clean working tree without any uncommitted changes. ${withTools.withGit} HEAD ${check} ;; esac diff --git a/nix/tools/docs.nix b/nix/tools/docs.nix index ec7bddd50..83abd5f19 100644 --- a/nix/tools/docs.nix +++ b/nix/tools/docs.nix @@ -43,7 +43,7 @@ let } if [ "$_arg_language" == "" ]; then - # clean previous build, otherwise some errors might be supressed + # clean previous build, otherwise some errors might be suppressed rm -rf "../.docs-build/html/default" if [ -d languages ]; then @@ -54,7 +54,7 @@ let build html "../.docs-build/html/default" else - # clean previous build, otherwise some errors might be supressed + # clean previous build, otherwise some errors might be suppressed rm -rf "../.docs-build/html/$_arg_language" # update and build specific locale, can be used to create new locale diff --git a/nix/tools/release.nix b/nix/tools/release.nix index 3f6ac74dc..7f0fa8209 100644 --- a/nix/tools/release.nix +++ b/nix/tools/release.nix @@ -68,7 +68,7 @@ let bump devel # The order of operations is important here: - # - bump devel is run and $A is upated to the new version + # - bump devel is run and $A is updated to the new version # - the branch is created with the new A, but the commit before the devel bump # - the devel bump is committed git branch "v$A" diff --git a/nix/tools/style.nix b/nix/tools/style.nix index ce1d74982..d53ce9e2b 100644 --- a/nix/tools/style.nix +++ b/nix/tools/style.nix @@ -36,12 +36,12 @@ let ${black}/bin/black . 2> /dev/null ''; - # Script to check whether any uncommited changes result from postgrest-style + # Script to check whether any uncommitted changes result from postgrest-style styleCheck = checkedShellScript { name = "postgrest-style-check"; - docs = "Check whether postgrest-style results in any uncommited changes."; + docs = "Check whether postgrest-style results in any uncommitted changes."; workingDir = "/"; } '' diff --git a/src/PostgREST/ApiRequest.hs b/src/PostgREST/ApiRequest.hs index fed1c6ac0..6cf7f3c7c 100644 --- a/src/PostgREST/ApiRequest.hs +++ b/src/PostgREST/ApiRequest.hs @@ -64,7 +64,7 @@ data ApiRequest = ApiRequest { , iPayload :: Maybe Payload -- ^ Data sent by client and used for mutation actions , iPreferences :: Preferences.Preferences -- ^ Prefer header values , iQueryParams :: QueryParams.QueryParams - , iColumns :: S.Set FieldName -- ^ parsed colums from &columns parameter and payload + , iColumns :: S.Set FieldName -- ^ parsed columns from &columns parameter and payload , iHeaders :: [(ByteString, ByteString)] -- ^ HTTP request headers , iCookies :: [(ByteString, ByteString)] -- ^ Request Cookies , iPath :: ByteString -- ^ Raw request path diff --git a/src/PostgREST/AppState.hs b/src/PostgREST/AppState.hs index fe07451a8..ed2eef3fc 100644 --- a/src/PostgREST/AppState.hs +++ b/src/PostgREST/AppState.hs @@ -262,7 +262,7 @@ usePool AppState{stateObserver=observer, stateMainThreadId=mainThreadId, ..} ses when (Error.status (Error.PgError False err) >= HTTP.status500) $ observer $ QueryErrorCodeHighObs err err@(SQL.SessionUsageError (SQL.QueryError _ _ (SQL.ClientError _))) -> - -- An error on the client-side, usually indicates problems wth connection + -- An error on the client-side, usually indicates problems with connection observer $ QueryErrorCodeHighObs err ) diff --git a/src/PostgREST/Config.hs b/src/PostgREST/Config.hs index ecdac6a7b..a5706a74d 100644 --- a/src/PostgREST/Config.hs +++ b/src/PostgREST/Config.hs @@ -694,13 +694,13 @@ exampleConfigFile = S.unlines , "## How to terminate database transactions" , "## Possible values are:" , "## commit (default)" - , "## Transaction is always committed, this can not be overriden" + , "## Transaction is always committed, this can not be overridden" , "## commit-allow-override" - , "## Transaction is committed, but can be overriden with Prefer tx=rollback header" + , "## Transaction is committed, but can be overridden with Prefer tx=rollback header" , "## rollback" - , "## Transaction is always rolled back, this can not be overriden" + , "## Transaction is always rolled back, this can not be overridden" , "## rollback-allow-override" - , "## Transaction is rolled back, but can be overriden with Prefer tx=commit header" + , "## Transaction is rolled back, but can be overridden with Prefer tx=commit header" , "db-tx-end = \"commit\"" , "" , "## The standard connection URI format, documented at" diff --git a/src/PostgREST/Plan/Types.hs b/src/PostgREST/Plan/Types.hs index 92eedf37b..f479960bd 100644 --- a/src/PostgREST/Plan/Types.hs +++ b/src/PostgREST/Plan/Types.hs @@ -47,7 +47,7 @@ data CoercibleField = CoercibleField , cfBaseType :: Text -- ^ The base type of the field in case of domains, or just the type otherwise (without modifiers in case of pg_catalog types) , cfTransform :: Maybe TransformerProc -- ^ The optional mapping from irType -> targetType. , cfDefault :: Maybe Text - , cfFullRow :: Bool -- ^ True if the field represents the whole selected row. Used in spread rels: instead of COUNT(*), it does a COUNT(<row>) in order to not mix with other spreaded resources. + , cfFullRow :: Bool -- ^ True if the field represents the whole selected row. Used in spread rels: instead of COUNT(*), it does a COUNT(<row>) in order to not mix with other spread resources. } deriving (Eq, Show) unknownField :: FieldName -> JsonPath -> CoercibleField diff --git a/src/PostgREST/Query/QueryBuilder.hs b/src/PostgREST/Query/QueryBuilder.hs index d69a3709b..f84a5e2d7 100644 --- a/src/PostgREST/Query/QueryBuilder.hs +++ b/src/PostgREST/Query/QueryBuilder.hs @@ -264,7 +264,7 @@ readPlanToCountQuery (Node ReadPlan{from=mainQi, fromAlias=tblAlias, where_=logi limitedQuery :: SQL.Snippet -> Maybe Integer -> SQL.Snippet limitedQuery query maxRows = query <> SQL.sql (maybe mempty (\x -> " LIMIT " <> BS.pack (show x)) maxRows) --- TODO refactor so this function is uneeded and ComputedRelationship QualifiedIdentifier comes from the ReadPlan type +-- TODO refactor so this function is unneeded and ComputedRelationship QualifiedIdentifier comes from the ReadPlan type getQualifiedIdentifier :: Maybe Relationship -> QualifiedIdentifier -> Maybe Alias -> QualifiedIdentifier getQualifiedIdentifier rel mainQi tblAlias = case rel of Just ComputedRelationship{relFunction} -> QualifiedIdentifier mempty $ fromMaybe (qiName relFunction) tblAlias diff --git a/src/PostgREST/SchemaCache.hs b/src/PostgREST/SchemaCache.hs index f69ec8824..f2f859074 100644 --- a/src/PostgREST/SchemaCache.hs +++ b/src/PostgREST/SchemaCache.hs @@ -931,7 +931,7 @@ allViewsKeyDependencies = -- This leads to a smaller json result as well. -- Removal stops at `,` for used fields (see above) and `}` for the end of the current node. -- Nesting can't be parsed correctly with a regex, so we stop at `{` as well and - -- add an empty key for the followig node. + -- add an empty key for the following node. ), ' :[^}{,]+' , ',"":' , 'g' -- For performance, the regex also added those empty keys when hitting a `,` or `}`. -- Those are removed next.