Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection of docs fixes #3234

Merged
merged 19 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6203e23
docs: Various formatting improvements
wolfgangwalther Feb 18, 2024
a33de06
docs: Update output in tutorials to latest version
wolfgangwalther Feb 18, 2024
de771c8
docs: Use port 5432 in tutorial 0 to avoid connecting to the wrong se…
wolfgangwalther Feb 18, 2024
5fe941a
docs: Remove note about possible memory leak on alpine
wolfgangwalther Feb 18, 2024
7965392
docs: Remove note about risk of asymmetric keys for JWT auth
wolfgangwalther Feb 18, 2024
dfca17d
docs: Clarify secret wording in tutorial 1
wolfgangwalther Feb 18, 2024
c2171f1
docs: Remove deprecated auth0 features
wolfgangwalther Feb 18, 2024
0deeead
docs: Rename remaining instances of computed columns to computed fields
wolfgangwalther Feb 18, 2024
bc1e385
docs: Add links to resource embedding from insert/update/delete sections
wolfgangwalther Feb 18, 2024
aeac5d1
docs: Change tutorials to use identity column instead of serial/sequence
wolfgangwalther Feb 18, 2024
df3abb3
docs: Add example for ordering by json field
wolfgangwalther Feb 18, 2024
bbecb53
docs: Clarify behavior of jwt-aud and tokens without aud claim
wolfgangwalther Feb 18, 2024
a5786f9
docs: Add hint about schema reloading with db-config=true
wolfgangwalther Feb 18, 2024
0e1e1aa
docs: Sort datatypes how-to alphabetically
wolfgangwalther Feb 18, 2024
4e1128e
docs: Improve introduction for datatypes how-to
wolfgangwalther Feb 18, 2024
89c4e63
docs: Add example on how to automatically store mimetype in files table
wolfgangwalther Feb 18, 2024
c84b67c
docs: Use code-block postgres consistently
wolfgangwalther Feb 19, 2024
e0f60d3
docs: Display version number more prominently
wolfgangwalther Feb 18, 2024
15a1842
chore: Add docs/_build to .gitignore again to allow switching to old …
wolfgangwalther Feb 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
_build
Pipfile.lock
*.aux
*.log
Expand Down
18 changes: 7 additions & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,16 @@
# The master toctree document.
master_doc = "index"

# This is overriden by readthedocs with the version tag anyway
version = "devel"
# To avoid repetition in <title> we set this to an empty string.
release = ""

# General information about the project.
project = "PostgREST"
project = "PostgREST " + version
author = "Joe Nelson, Steve Chavez"
copyright = "2017, " + author

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "12.1"
# The full version, including alpha/beta/rc tags.
release = "12.1-dev"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
Expand Down Expand Up @@ -117,7 +113,7 @@
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
html_theme_options = {"display_version": False}

# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
Expand Down
21 changes: 9 additions & 12 deletions docs/explanations/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,15 @@ If you want to have a visual overview of your API in your browser you can add sw

.. code-block:: yaml

swagger:
image: swaggerapi/swagger-ui
ports:
- "8080:8080"
expose:
- "8080"
environment:
API_URL: http://localhost:3000/
# in services:
swagger:
image: swaggerapi/swagger-ui
ports:
- "8080:8080"
expose:
- "8080"
environment:
API_URL: http://localhost:3000/

With this you can see the swagger-ui in your browser on port 8080.

Expand All @@ -181,10 +182,6 @@ Building from Source

When a pre-built binary does not exist for your system you can build the project from source.

.. note::

We discourage building and using PostgREST on **Alpine Linux** because of a reported GHC memory leak on that platform.

You can build PostgREST from source with `Stack <https://github.com/commercialhaskell/stack>`_. It will install any necessary Haskell dependencies on your system.

* `Install Stack <https://docs.haskellstack.org/en/stable/README/#how-to-install-stack>`_ for your platform
Expand Down
4 changes: 3 additions & 1 deletion docs/how-tos/providing-images-for-img.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ First, in addition to the minimal example, we need to store the media types and
.. code-block:: postgres
alter table files
add column type text,
add column type text generated always as (byteamagic_mime(substr(blob, 0, 4100))) stored,
add column name text;
This uses the :code:`byteamagic_mime()` function from the `pg_byteamagic extension <https://github.com/nmandery/pg_byteamagic>`_ to automatically generate the type in the :code:`files` table. To guess the type of a file, it's generally enough to look at the beginning of the file, which is more efficient.

Next, we set modify the function to set the content type and filename.
We use this opportunity to configure some basic, client-side caching.
For production, you probably want to configure additional caches, e.g. on the :ref:`reverse proxy <nginx>`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Concerning the `pgjwt extension <https://github.com/michelp/pgjwt>`_, please cf.

In order to be able to work with postgres' SCRAM-SHA-256 password hashes, we also need the PBKDF2 key derivation function. Luckily there is `a PL/pgSQL implementation on stackoverflow <https://stackoverflow.com/a/72805848>`_:

.. code-block:: plpgsql
.. code-block:: postgres

CREATE FUNCTION basic_auth.pbkdf2(salt bytea, pw text, count integer, desired_length integer, algorithm text) RETURNS bytea
LANGUAGE plpgsql IMMUTABLE
Expand Down Expand Up @@ -120,7 +120,7 @@ In order to be able to work with postgres' SCRAM-SHA-256 password hashes, we als
Analogous to :ref:`sql_user_management` creates the function :code:`basic_auth.user_role`, we create a helper function to check the user's password, here with another name and signature (since we want the username, not an email address).
But contrary to :ref:`sql_user_management`, this function does not use a dedicated :code:`users` table with passwords, but instead utilizes the built-in table `pg_catalog.pg_authid <https://www.postgresql.org/docs/current/catalog-pg-authid.html>`_:

.. code-block:: plpgsql
.. code-block:: postgres

CREATE FUNCTION basic_auth.check_user_pass(username text, password text) RETURNS name
LANGUAGE sql
Expand Down Expand Up @@ -160,7 +160,7 @@ Logins
As described in :ref:`client_auth`, we'll create a JWT token inside our login function. Note that you'll need to adjust the secret key which is hard-coded in this example to a secure (at least thirty-two character) secret of your choosing.


.. code-block:: plpgsql
.. code-block:: postgres

CREATE TYPE basic_auth.jwt_token AS (
token text
Expand Down
6 changes: 3 additions & 3 deletions docs/how-tos/sql-user-management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ First we'll need a table to keep track of our users:

We would like the role to be a foreign key to actual database roles, however PostgreSQL does not support these constraints against the :code:`pg_roles` table. We'll use a trigger to manually enforce it.

.. code-block:: plpgsql
.. code-block:: postgres

create or replace function
basic_auth.check_role_exists() returns trigger as $$
Expand All @@ -50,7 +50,7 @@ We would like the role to be a foreign key to actual database roles, however Pos

Next we'll use the pgcrypto extension and a trigger to keep passwords safe in the :code:`users` table.

.. code-block:: plpgsql
.. code-block:: postgres

create extension if not exists pgcrypto;

Expand All @@ -72,7 +72,7 @@ Next we'll use the pgcrypto extension and a trigger to keep passwords safe in th

With the table in place we can make a helper to check a password against the encrypted column. It returns the database role for a user if the email and password are correct.

.. code-block:: plpgsql
.. code-block:: postgres

create or replace function
basic_auth.user_role(email text, pass text) returns name
Expand Down
Loading
Loading