~bigbes/core-go

ref: 562662dcaf9ec186bb20458d9ed07d3d4ab61b3e core-go/server/server.go -rw-r--r-- 8.6 KiB
e1b63989 — Conrad Hoffmann 1 year, 9 months ago
redis: use UniveralClient, support sentinel mode

This commit switches the redis client to using a UniversalClient [1],
which can operate in standard, cluster, or failover (sentinel) mode.

It also implements basic support for having (multiple)
`redis+sentinel://` URLs as connection URL in the config (e.g. for
`redis-host`).

This is the Go equivalent of the proposed Python patch [2]. It supports
the same examples given there.

[1] https://pkg.go.dev/github.com/go-redis/redis/v8#UniversalClient
[2] https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/55521
9833a827 — Drew DeVault 1 year, 9 months ago
server: add AnonRouter function

To expose anonymous (unauthenticated) routing to downstream core-go
users.
8f9aa9d5 — Drew DeVault 1 year, 9 months ago
server: fix playground on config.Debug

A recent change made it so that the playground required authentication
to access in debug mode; this moves it under the other auth-free
endpoints.
0d6031be — Conrad Hoffmann 1 year, 11 months ago
server: use routing groups

Instead of hardcoding some exceptions in the auth middleware, use a
different routing group for routes that do not require auth. Makes the
auth middleware more generic and also removes a lot of unneccessary
middleware processing from routes that don't need it.

For now, the added group is not accessible from outside the module, but
if the need arises, this might be an option.
d2ad494f — Simon Ser 2 years ago
Migrate to chi v5

v1 is not maintained anymore.
144fc447 — Drew DeVault 3 years ago
server: register SQL collector

Missed this step
fa27910a — Drew DeVault 3 years ago
Add prometheus SQL connection stats

Also updates the prometheus client_go library
0b2fef24 — Conrad Hoffmann 4 years ago
Normalize remote address before saving to context

One cause for https://todo.sr.ht/~sircmpwn/meta.sr.ht/193 was that code
performing this sanitization was in multiple places, and a fix was not
applied in all places. There is no reasonable expectation for the port
to be present anyways, e.g. if the address is taken from a trusted
reverse proxy's header. Hence, perform the normalization here, so that
the code doing this in applications can be simplified.

Note that this does not yet fix the below ticket, it will just make the
fix easier.

References: https://todo.sr.ht/~sircmpwn/meta.sr.ht/193
8c2729f4 — Adnan Maolood 4 years ago
email.EnqueueStd: Don't overwrite headers

Sometimes we need to specify the Message-Id, From, and Reply-To headers
(e.g. for todo.sr.ht ticket notifications). Don't overwrite these
headers if they are present.
dea4ef29 — Drew DeVault 4 years ago
server: move auth middlware ahead of RealIP

So that @internal auth can correctly test against internal-ipnet.
48250772 — Simon Ser 4 years ago
Remove %e formatting verbs

%e is not valid for formatting error values:

> %e	scientific notation, e.g. -1.234456e+78

Instead, use %w when using fmt.Errorf (for error wrapping) and
%v when using log.Printf (%w is not valid in that context).
5f76a1f4 — Drew DeVault 4 years ago
Enforce complexity limit on webhook payload
1371ba4b — Drew DeVault 4 years ago
Configure server to manage mail queue

This also sets up the recovery function for webhooks, so we get emailed
when we panic during a webhook query.
67ddd428 — Drew DeVault 5 years ago
server: add server reference to context
6bcaea61 — Drew DeVault 5 years ago
server: set max upload size to 1 GiB
5de4cd8e — Drew DeVault 5 years ago
Stash remote address in context
af2afebd — Drew DeVault 5 years ago
Add legacy webhooks worker implementation
14f4b921 — Drew DeVault 5 years ago
Expand context for work queues
5b2fce24 — Drew DeVault 5 years ago
server: use SO_REUSEADDR for main listener
f53a762c — Drew DeVault 5 years ago
server: add /query/api-meta.json, docs
Next