~sircmpwn/core.sr.ht

redis, oauth/blueprint: fix some typos

Just some sneaky typos that have snuck in.

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
Reduce scope of user types

Pulling payment_status out of user_type.
redis: fix use of undefined variable

This escaped my testing of the redis sentinel patches. Only occurs when
putting multiple URLs in the config.
redis: support connecting via sentinels

Redis/Redict use the concept of sentinels [1] to achieve high
availability via hot stand-bys. This commit allows utilizing sentinels
to connect to HA instances by supporting the `redis+sentinel` and
`rediss+sentinel` URL schemes in the connection URL.

Since sentinels are usually clustered (otherwise they would become the
single point of failure), this commit also allows specifying multiple,
comma separated connection URLs, but only for `+sentinel` URLs.

The concept of a sentinel connection URL is not well-standardized. The
idea seems to have been popularized by [2]. Most other projects have
picked up the scheme (`redis+sentinel`) and the path semantics
(`/<master_name>`, optionally followed by `/<db>`). Like other projects,
this implementation ditches the "multiple, comma separated hosts in a
single URL" idea in favor of using multiple proper URLs, even though
this introduces some slight risk of inconsistency (the library requires
all connections to use the same username and password, but one could
specify different ones for each sentinel). But the benefit of not having
to customize the URL parsing easily wins here.

Some examples of what the `redis-host` directive could look like:

    # Regular redis:// URLs still work like before
    redis-host=redis://127.0.0.1:6379/1

    # Connect to a single sentinel (not HA), using the redis master
    # "mymaster" (see [1]), the database "1", and the provided
    # credentials
    redis-host=redis+sentinel://default:foobar@localhost:26379/mymaster/1

    # Connect to a set of sentinels (HA), using the redis master
    # "mymaster" (see [1]), the default database, no auth
    redis-host=redis+sentinel://localhost:26379/mymaster,redis+sentinel://localhost:26380/mymaster,redis+sentinel://localhost:26381/mymaster

[1] https://redict.io/docs/usage/sentinel/
[2] https://github.com/exponea/redis-sentinel-url
layout.html: fix user type case
Set UserType values to uppercase

To match a coming migration.
fix canonical link to hub profile
srht.validation: fix enum usage

This previously matched form fields on enum member names, not their
values; their values is more appropriate.
internal_error.html: add comment
oauth/decorator: fix metric name
.builds: upgrade to alpine 3.20
srht.oauth.ExternalUserMixin: drop oauth_revocation_token

This isn't used for anything
Drop srht-replicate-db

This was never really useful IIUC.
srht.oauth: add prometheus metric for legacy use

To get an idea of the current usage of the legacy API in preparation for
its removal.
config: force full map() execution

Make sure all globbed configs are loaded by inserting a `list()` call,
which will force all globbed items to be mapped to the loaded config.
config: Add /etc/sr.ht/config.ini to paths

At the moment all ".ini" files under /etc/sr.ht are loaded - even if
/etc/sr.ht/config.ini exists. To conform with the Go equivalent [1],
only config.ini will be loaded if it exists.

[1]: https://git.sr.ht/~sircmpwn/core-go/commit/3c1346e6bbc37884ca5eb390e22728e4c40e3fa5
34213d6d — Eli Schwartz 6 months ago 0.74.1
fix scripts disappearing after pyproject.toml conversion

In commit 1fbbcabb7c23516cf08f9581c5ea4876aa89326d, setup.py was reduced
to a stub loader for the pyproject.toml static metadata.

Without getting into whether it makes sense to programmatically vs.
statically define e.g. package_data, the scripts= argument to setup()
was never included in pyproject.toml and was removed from setup.py; this
broke the resulting installed package.

Restore this information.

Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Makefile: consistently use $(MODULE)

The target in question currently seems to not cause any issues, but it
does when switching dependents to the modern Python module structure,
where the build tools will build the package in a temporary virtual
environment.
pyproject.toml: properly define package data

Apparently even empty (i.e. non-Python) packages have to be defined as
packages, and the desired package data defined for each one. Also, as
long as `include-package-data` is true (the default), _everything_ will
be included, so set it to false.
Reduce setup.py to a stub

All configuration is now in pyproject.toml, all tooling set up to use
it. The stub remains for backwards compatibility. See 57ee342 and
https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
Next